diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/_meta.json b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/_meta.json index f96970d0f1c41..1e565b86e64bc 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/_meta.json +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/_meta.json @@ -1,11 +1,6 @@ { - "commit": "9e025bcb77df66ed746a6e6c87745dc3abe11cde", + "commit": "37cac643c368dd75de2b98d1d0e3b16dea37b2eb", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", - "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" - ], - "autorest_command": "autorest specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", - "readme": "specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/readme.md" + "typespec_src": "specification/workloads/Workloads.SAPVirtualInstance.Management", + "@azure-tools/typespec-python": "0.37.1" } \ No newline at end of file diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/__init__.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/__init__.py index a16e7fa2daf58..67cba625bd892 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/__init__.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/__init__.py @@ -2,18 +2,24 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._workloads_sap_virtual_instance_mgmt_client import WorkloadsSapVirtualInstanceMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import WorkloadsSapVirtualInstanceMgmtClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "WorkloadsSapVirtualInstanceMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_workloads_sap_virtual_instance_mgmt_client.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_client.py similarity index 63% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_workloads_sap_virtual_instance_mgmt_client.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_client.py index 40b128c9d14fd..e9f9af7e6dd4d 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_workloads_sap_virtual_instance_mgmt_client.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_client.py @@ -2,60 +2,58 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from . import models as _models from ._configuration import WorkloadsSapVirtualInstanceMgmtClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( Operations, SAPApplicationServerInstancesOperations, - SAPCentralInstancesOperations, + SAPCentralServerInstancesOperations, SAPDatabaseInstancesOperations, SAPVirtualInstancesOperations, - WorkloadsSapVirtualInstanceMgmtClientOperationsMixin, ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class WorkloadsSapVirtualInstanceMgmtClient( - WorkloadsSapVirtualInstanceMgmtClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword +class WorkloadsSapVirtualInstanceMgmtClient: """Workloads client provides access to various workload operations. + :ivar operations: Operations operations + :vartype operations: azure.mgmt.workloadssapvirtualinstance.operations.Operations :ivar sap_virtual_instances: SAPVirtualInstancesOperations operations :vartype sap_virtual_instances: azure.mgmt.workloadssapvirtualinstance.operations.SAPVirtualInstancesOperations - :ivar sap_central_instances: SAPCentralInstancesOperations operations - :vartype sap_central_instances: - azure.mgmt.workloadssapvirtualinstance.operations.SAPCentralInstancesOperations + :ivar sap_central_server_instances: SAPCentralServerInstancesOperations operations + :vartype sap_central_server_instances: + azure.mgmt.workloadssapvirtualinstance.operations.SAPCentralServerInstancesOperations :ivar sap_database_instances: SAPDatabaseInstancesOperations operations :vartype sap_database_instances: azure.mgmt.workloadssapvirtualinstance.operations.SAPDatabaseInstancesOperations :ivar sap_application_server_instances: SAPApplicationServerInstancesOperations operations :vartype sap_application_server_instances: azure.mgmt.workloadssapvirtualinstance.operations.SAPApplicationServerInstancesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.workloadssapvirtualinstance.operations.Operations - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-09-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -68,19 +66,38 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: + _endpoint = "{endpoint}" self._config = WorkloadsSapVirtualInstanceMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False + self.operations = Operations(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.sap_central_server_instances = SAPCentralServerInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) self.sap_database_instances = SAPDatabaseInstancesOperations( @@ -89,15 +106,14 @@ def __init__( 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) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def send_request(self, request: HttpRequest, *, stream: bool = False, **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) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -110,13 +126,17 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "WorkloadsSapVirtualInstanceMgmtClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_configuration.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_configuration.py index e8d27150a2da3..27c8ed130786a 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_configuration.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_configuration.py @@ -2,41 +2,46 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 WorkloadsSapVirtualInstanceMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class WorkloadsSapVirtualInstanceMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for WorkloadsSapVirtualInstanceMgmtClient. 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. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding - this default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is "2024-09-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(WorkloadsSapVirtualInstanceMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-10-01-preview") + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2024-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -45,9 +50,11 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-workloadssapvirtualinstance/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +63,9 @@ def _configure(self, **kwargs: Any) -> None: 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.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_model_base.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_model_base.py new file mode 100644 index 0000000000000..7f73b97b23efa --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_model_base.py @@ -0,0 +1,1175 @@ +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object + def __init__(self, data: typing.Dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> typing.Tuple[str, typing.Any]: + return self._data.popitem() + + def clear(self) -> None: + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field( + attr_to_rest_field: typing.Dict[str, "_RestField"], rest_name: str +) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: typing.Set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) # pylint: disable=no-value-for-parameter + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: typing.Dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: typing.List[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + if annotation._name == "Dict": # pyright: ignore + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, value, module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[typing.Dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, typing.List[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[typing.Dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element(tag, prefix=None, ns=None): + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: typing.Dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: typing.List[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_serialization.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_serialization.py index f958e014458b2..b24ab2885450d 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_serialization.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_serialization.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +25,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +52,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -63,8 +62,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -91,6 +90,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -124,7 +125,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +144,9 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -170,13 +178,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -189,15 +190,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -211,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -240,24 +256,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: - self.additional_properties: Dict[str, Any] = {} - for k in kwargs: + self.additional_properties: Optional[Dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -305,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -331,7 +366,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -340,7 +379,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +390,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -385,12 +426,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -400,7 +444,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -413,9 +457,10 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -431,9 +476,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -445,7 +492,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -453,14 +500,18 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None @@ -506,11 +557,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -545,7 +598,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,17 +614,20 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict :raises: SerializationError if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -597,12 +653,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -638,7 +696,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -649,7 +708,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,18 +727,18 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) - else: - return serialized + raise SerializationError(msg) from err + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict :raises: SerializationError if serialization fails. :raises: ValueError if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -708,18 +767,20 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -730,30 +791,30 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -763,19 +824,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -784,32 +846,31 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None :raises: AttributeError if required data is None. :raises: ValueError if data is None :raises: SerializationError if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -824,12 +885,11 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) - else: - return self._serialize(data, **kwargs) + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -845,23 +905,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -875,8 +938,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -886,15 +948,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -949,9 +1009,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -975,7 +1034,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -983,6 +1042,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -993,7 +1053,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1007,7 +1067,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1038,56 +1098,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1095,11 +1160,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1109,30 +1175,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1145,12 +1213,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,19 +1239,20 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int :raises: SerializationError if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1190,11 +1260,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1209,14 +1279,15 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,7 +1301,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1238,17 +1308,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1285,7 +1367,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1337,22 +1419,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1360,7 +1441,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1369,9 +1450,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1472,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1409,11 +1490,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1422,12 +1504,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1444,15 +1527,15 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1481,10 +1564,9 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1511,18 +1593,20 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1537,10 +1621,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1558,10 +1644,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1578,31 +1666,42 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1611,15 +1710,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1633,7 +1733,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1652,15 +1756,15 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) - else: - return self._deserialize(obj_type, data) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1677,6 +1781,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1687,11 +1792,12 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1700,7 +1806,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1726,11 +1832,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1738,6 +1843,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1749,24 +1855,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1774,6 +1879,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1787,8 +1893,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1800,6 +1905,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1808,12 +1914,11 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1829,6 +1934,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1841,6 +1947,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1856,22 +1963,24 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1884,6 +1993,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1893,15 +2003,15 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) - else: - return duration + raise DeserializationError(msg) from err + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1910,13 +2020,14 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1931,6 +2042,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1945,15 +2057,15 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1982,9 +2094,8 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj @staticmethod def deserialize_unix(attr): @@ -1992,15 +2103,16 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_vendor.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_vendor.py deleted file mode 100644 index 3f8686f3c5f5a..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_vendor.py +++ /dev/null @@ -1,36 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 abc import ABC -from typing import TYPE_CHECKING - -from azure.core.pipeline.transport import HttpRequest - -from ._configuration import WorkloadsSapVirtualInstanceMgmtClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import PipelineClient - - from ._serialization import Deserializer, Serializer - - -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 - - -class WorkloadsSapVirtualInstanceMgmtClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "PipelineClient" - _config: WorkloadsSapVirtualInstanceMgmtClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_version.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_version.py index e5754a47ce68f..be71c81bd2821 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_version.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/_version.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/__init__.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/__init__.py index 94dec8f809d67..d0be043fb1b5b 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/__init__.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/__init__.py @@ -2,15 +2,21 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._workloads_sap_virtual_instance_mgmt_client import WorkloadsSapVirtualInstanceMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import WorkloadsSapVirtualInstanceMgmtClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "WorkloadsSapVirtualInstanceMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_workloads_sap_virtual_instance_mgmt_client.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_client.py similarity index 63% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_workloads_sap_virtual_instance_mgmt_client.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_client.py index b8744da1ccd48..9791300c38d27 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_workloads_sap_virtual_instance_mgmt_client.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_client.py @@ -2,60 +2,58 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import WorkloadsSapVirtualInstanceMgmtClientConfiguration from .operations import ( Operations, SAPApplicationServerInstancesOperations, - SAPCentralInstancesOperations, + SAPCentralServerInstancesOperations, SAPDatabaseInstancesOperations, SAPVirtualInstancesOperations, - WorkloadsSapVirtualInstanceMgmtClientOperationsMixin, ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class WorkloadsSapVirtualInstanceMgmtClient( - WorkloadsSapVirtualInstanceMgmtClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword +class WorkloadsSapVirtualInstanceMgmtClient: """Workloads client provides access to various workload operations. + :ivar operations: Operations operations + :vartype operations: azure.mgmt.workloadssapvirtualinstance.aio.operations.Operations :ivar sap_virtual_instances: SAPVirtualInstancesOperations operations :vartype sap_virtual_instances: azure.mgmt.workloadssapvirtualinstance.aio.operations.SAPVirtualInstancesOperations - :ivar sap_central_instances: SAPCentralInstancesOperations operations - :vartype sap_central_instances: - azure.mgmt.workloadssapvirtualinstance.aio.operations.SAPCentralInstancesOperations + :ivar sap_central_server_instances: SAPCentralServerInstancesOperations operations + :vartype sap_central_server_instances: + azure.mgmt.workloadssapvirtualinstance.aio.operations.SAPCentralServerInstancesOperations :ivar sap_database_instances: SAPDatabaseInstancesOperations operations :vartype sap_database_instances: azure.mgmt.workloadssapvirtualinstance.aio.operations.SAPDatabaseInstancesOperations :ivar sap_application_server_instances: SAPApplicationServerInstancesOperations operations :vartype sap_application_server_instances: azure.mgmt.workloadssapvirtualinstance.aio.operations.SAPApplicationServerInstancesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.workloadssapvirtualinstance.aio.operations.Operations - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is "2024-09-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -68,19 +66,38 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: + _endpoint = "{endpoint}" self._config = WorkloadsSapVirtualInstanceMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False + self.operations = Operations(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.sap_central_server_instances = SAPCentralServerInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) self.sap_database_instances = SAPDatabaseInstancesOperations( @@ -89,15 +106,16 @@ def __init__( 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) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def send_request( + self, request: HttpRequest, *, stream: bool = False, **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) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -110,13 +128,17 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "WorkloadsSapVirtualInstanceMgmtClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_configuration.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_configuration.py index f4b8a46f4605f..a667f693e1caa 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_configuration.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_configuration.py @@ -2,41 +2,46 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 WorkloadsSapVirtualInstanceMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class WorkloadsSapVirtualInstanceMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for WorkloadsSapVirtualInstanceMgmtClient. 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. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-10-01-preview". Note that overriding - this default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is "2024-09-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(WorkloadsSapVirtualInstanceMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-10-01-preview") + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2024-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -45,9 +50,11 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-workloadssapvirtualinstance/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +63,9 @@ def _configure(self, **kwargs: Any) -> None: 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.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_vendor.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_vendor.py deleted file mode 100644 index 66586b8004214..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/_vendor.py +++ /dev/null @@ -1,28 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 abc import ABC -from typing import TYPE_CHECKING - -from azure.core.pipeline.transport import HttpRequest - -from ._configuration import WorkloadsSapVirtualInstanceMgmtClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import AsyncPipelineClient - - from .._serialization import Deserializer, Serializer - - -class WorkloadsSapVirtualInstanceMgmtClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "AsyncPipelineClient" - _config: WorkloadsSapVirtualInstanceMgmtClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/__init__.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/__init__.py index b5dcb87baf6c6..f607fa6f285be 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/__init__.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/__init__.py @@ -2,28 +2,32 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._workloads_sap_virtual_instance_mgmt_client_operations import WorkloadsSapVirtualInstanceMgmtClientOperationsMixin -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 typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import SAPVirtualInstancesOperations # type: ignore +from ._operations import SAPCentralServerInstancesOperations # type: ignore +from ._operations import SAPDatabaseInstancesOperations # type: ignore +from ._operations import SAPApplicationServerInstancesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "WorkloadsSapVirtualInstanceMgmtClientOperationsMixin", + "Operations", "SAPVirtualInstancesOperations", - "SAPCentralInstancesOperations", + "SAPCentralServerInstancesOperations", "SAPDatabaseInstancesOperations", "SAPApplicationServerInstancesOperations", - "Operations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_operations.py index 150ac10795750..023e00749e0a9 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_operations.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_operations.py @@ -3,10 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 io import IOBase +import json +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -16,22 +19,65 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -from .._vendor import WorkloadsSapVirtualInstanceMgmtClientMixinABC +from ..._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ...operations._operations import ( + build_operations_list_request, + build_sap_application_server_instances_create_request, + build_sap_application_server_instances_delete_request, + build_sap_application_server_instances_get_request, + build_sap_application_server_instances_list_request, + build_sap_application_server_instances_start_request, + build_sap_application_server_instances_stop_request, + build_sap_application_server_instances_update_request, + build_sap_central_server_instances_create_request, + build_sap_central_server_instances_delete_request, + build_sap_central_server_instances_get_request, + build_sap_central_server_instances_list_request, + build_sap_central_server_instances_start_request, + build_sap_central_server_instances_stop_request, + build_sap_central_server_instances_update_request, + build_sap_database_instances_create_request, + build_sap_database_instances_delete_request, + build_sap_database_instances_get_request, + build_sap_database_instances_list_request, + build_sap_database_instances_start_request, + build_sap_database_instances_stop_request, + build_sap_database_instances_update_request, + build_sap_virtual_instances_create_request, + build_sap_virtual_instances_delete_request, + build_sap_virtual_instances_get_availability_zone_details_request, + build_sap_virtual_instances_get_disk_configurations_request, + build_sap_virtual_instances_get_request, + build_sap_virtual_instances_get_sap_supported_sku_request, + build_sap_virtual_instances_get_sizing_recommendations_request, + build_sap_virtual_instances_list_by_resource_group_request, + build_sap_virtual_instances_list_by_subscription_request, + build_sap_virtual_instances_start_request, + build_sap_virtual_instances_stop_request, + build_sap_virtual_instances_update_request, +) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object class Operations: @@ -44,8 +90,6 @@ class Operations: :attr:`operations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client = input_args.pop(0) if input_args else kwargs.pop("client") @@ -55,21 +99,798 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """Lists all the available API operations under this PR. + """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Operation or the result of cls(response) + :return: An iterator like instance of Operation :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class SAPVirtualInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloadssapvirtualinstance.aio.WorkloadsSapVirtualInstanceMgmtClient`'s + :attr:`sap_virtual_instances` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> _models.SAPVirtualInstance: + """Gets a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :return: SAPVirtualInstance. The SAPVirtualInstance is compatible with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) + + _request = build_sap_virtual_instances_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPVirtualInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + resource: Union[_models.SAPVirtualInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_virtual_instances_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + resource: _models.SAPVirtualInstance, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param resource: Virtual Instance for SAP solutions resource request body. Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPVirtualInstance. The SAPVirtualInstance + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param resource: Virtual Instance for SAP solutions resource request body. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPVirtualInstance. The SAPVirtualInstance + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param resource: Virtual Instance for SAP solutions resource request body. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPVirtualInstance. The SAPVirtualInstance + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + resource: Union[_models.SAPVirtualInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param resource: Virtual Instance for SAP solutions resource request body. Is one of the + following types: SAPVirtualInstance, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns SAPVirtualInstance. The SAPVirtualInstance + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SAPVirtualInstance, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SAPVirtualInstance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SAPVirtualInstance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + properties: Union[_models.UpdateSAPVirtualInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_virtual_instances_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + properties: _models.UpdateSAPVirtualInstanceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param properties: Request body to update a Virtual Instance for SAP solutions resource. + Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPVirtualInstanceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPVirtualInstance. The SAPVirtualInstance + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param properties: Request body to update a Virtual Instance for SAP solutions resource. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPVirtualInstance. The SAPVirtualInstance + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param properties: Request body to update a Virtual Instance for SAP solutions resource. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPVirtualInstance. The SAPVirtualInstance + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + properties: Union[_models.UpdateSAPVirtualInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param properties: Request body to update a Virtual Instance for SAP solutions resource. Is one + of the following types: UpdateSAPVirtualInstanceRequest, JSON, IO[bytes] Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPVirtualInstanceRequest or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns SAPVirtualInstance. The SAPVirtualInstance + is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SAPVirtualInstance, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SAPVirtualInstance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SAPVirtualInstance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_sap_virtual_instances_delete_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Virtual Instance for SAP solutions resource and its child resources, that is the + associated Central Services Instance, Application Server Instances and Database Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SAPVirtualInstance"]: + """Gets all Virtual Instances for SAP solutions resources in a Resource Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of SAPVirtualInstance + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SAPVirtualInstance]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -80,14 +901,19 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: 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 = build_sap_virtual_instances_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -99,37 +925,5091 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SAPVirtualInstance], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) 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"} + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SAPVirtualInstance"]: + """Gets all Virtual Instances for SAP solutions resources in a Subscription. + + :return: An iterator like instance of SAPVirtualInstance + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SAPVirtualInstance]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_sap_virtual_instances_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SAPVirtualInstance], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _start_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_virtual_instances_start_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Default value + is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Default value + is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Default value + is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Is one of the + following types: StartRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _stop_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_virtual_instances_stop_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Default value + is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Default value + is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Default value + is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Is one of the + following types: StopRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def get_sizing_recommendations( + self, + location: str, + body: _models.SAPSizingRecommendationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Gets the sizing recommendations. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPSizingRecommendationResult. The SAPSizingRecommendationResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_sizing_recommendations( + self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Gets the sizing recommendations. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPSizingRecommendationResult. The SAPSizingRecommendationResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_sizing_recommendations( + self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Gets the sizing recommendations. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPSizingRecommendationResult. The SAPSizingRecommendationResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_sizing_recommendations( + self, location: str, body: Union[_models.SAPSizingRecommendationRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Gets the sizing recommendations. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Is one of the following types: + SAPSizingRecommendationRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationRequest or + JSON or IO[bytes] + :return: SAPSizingRecommendationResult. The SAPSizingRecommendationResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPSizingRecommendationResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_virtual_instances_get_sizing_recommendations_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPSizingRecommendationResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def get_sap_supported_sku( + self, + location: str, + body: _models.SAPSupportedSkusRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedSkusRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPSupportedResourceSkusResult. The SAPSupportedResourceSkusResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_sap_supported_sku( + self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPSupportedResourceSkusResult. The SAPSupportedResourceSkusResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_sap_supported_sku( + self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPSupportedResourceSkusResult. The SAPSupportedResourceSkusResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_sap_supported_sku( + self, location: str, body: Union[_models.SAPSupportedSkusRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Is one of the following types: + SAPSupportedSkusRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedSkusRequest or JSON or + IO[bytes] + :return: SAPSupportedResourceSkusResult. The SAPSupportedResourceSkusResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPSupportedResourceSkusResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_virtual_instances_get_sap_supported_sku_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPSupportedResourceSkusResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def get_disk_configurations( + self, + location: str, + body: _models.SAPDiskConfigurationsRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPDiskConfigurationsResult. The SAPDiskConfigurationsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_disk_configurations( + self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPDiskConfigurationsResult. The SAPDiskConfigurationsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_disk_configurations( + self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPDiskConfigurationsResult. The SAPDiskConfigurationsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_disk_configurations( + self, location: str, body: Union[_models.SAPDiskConfigurationsRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Is one of the following types: + SAPDiskConfigurationsRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsRequest or JSON + or IO[bytes] + :return: SAPDiskConfigurationsResult. The SAPDiskConfigurationsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPDiskConfigurationsResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_virtual_instances_get_disk_configurations_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPDiskConfigurationsResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def get_availability_zone_details( + self, + location: str, + body: _models.SAPAvailabilityZoneDetailsRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPAvailabilityZoneDetailsResult. The SAPAvailabilityZoneDetailsResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_availability_zone_details( + self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPAvailabilityZoneDetailsResult. The SAPAvailabilityZoneDetailsResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_availability_zone_details( + self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPAvailabilityZoneDetailsResult. The SAPAvailabilityZoneDetailsResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_availability_zone_details( + self, location: str, body: Union[_models.SAPAvailabilityZoneDetailsRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Is one of the following types: + SAPAvailabilityZoneDetailsRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsRequest or + JSON or IO[bytes] + :return: SAPAvailabilityZoneDetailsResult. The SAPAvailabilityZoneDetailsResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPAvailabilityZoneDetailsResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_virtual_instances_get_availability_zone_details_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPAvailabilityZoneDetailsResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class SAPCentralServerInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloadssapvirtualinstance.aio.WorkloadsSapVirtualInstanceMgmtClient`'s + :attr:`sap_central_server_instances` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Gets the SAP Central Services Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :return: SAPCentralServerInstance. The SAPCentralServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) + + _request = build_sap_central_server_instances_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPCentralServerInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + resource: Union[_models.SAPCentralServerInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_central_server_instances_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + resource: _models.SAPCentralServerInstance, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. <br><br>This will be used by + service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param resource: The SAP Central Services Instance request body. Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPCentralServerInstance. The + SAPCentralServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. <br><br>This will be used by + service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param resource: The SAP Central Services Instance request body. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPCentralServerInstance. The + SAPCentralServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. <br><br>This will be used by + service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param resource: The SAP Central Services Instance request body. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPCentralServerInstance. The + SAPCentralServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + resource: Union[_models.SAPCentralServerInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. <br><br>This will be used by + service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param resource: The SAP Central Services Instance request body. Is one of the following types: + SAPCentralServerInstance, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns SAPCentralServerInstance. The + SAPCentralServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SAPCentralServerInstance, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SAPCentralServerInstance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SAPCentralServerInstance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + properties: _models.UpdateSAPCentralInstanceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. <br><br>This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param properties: The SAP Central Services Instance resource request body. Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPCentralInstanceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPCentralServerInstance. The SAPCentralServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. <br><br>This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param properties: The SAP Central Services Instance resource request body. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPCentralServerInstance. The SAPCentralServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. <br><br>This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param properties: The SAP Central Services Instance resource request body. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPCentralServerInstance. The SAPCentralServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + properties: Union[_models.UpdateSAPCentralInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. <br><br>This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param properties: The SAP Central Services Instance resource request body. Is one of the + following types: UpdateSAPCentralInstanceRequest, JSON, IO[bytes] Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPCentralInstanceRequest or JSON or + IO[bytes] + :return: SAPCentralServerInstance. The SAPCentralServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_central_server_instances_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPCentralServerInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_sap_central_server_instances_delete_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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[None]: + """Deletes the SAP Central Services Instance resource. <br><br>This will be used by + service only. Delete operation on this resource by end user will return a Bad Request error. + You can delete the parent resource, which is the Virtual Instance for SAP solutions resource, + using the delete operation on it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SAPCentralServerInstance"]: + # pylint: disable=line-too-long + """Lists the SAP Central Services Instance resource for the given Virtual Instance for SAP + solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :return: An iterator like instance of SAPCentralServerInstance + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SAPCentralServerInstance]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_sap_central_server_instances_list_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SAPCentralServerInstance], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _start_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_central_server_instances_start_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Is one of the following types: + StartRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _stop_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_central_server_instances_stop_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Is one of the following types: + StopRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class SAPDatabaseInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloadssapvirtualinstance.aio.WorkloadsSapVirtualInstanceMgmtClient`'s + :attr:`sap_database_instances` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Gets the SAP Database Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :return: SAPDatabaseInstance. The SAPDatabaseInstance is compatible with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) + + _request = build_sap_database_instances_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPDatabaseInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + resource: Union[_models.SAPDatabaseInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_database_instances_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + resource: _models.SAPDatabaseInstance, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param resource: Request body of Database resource of a SAP system. Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPDatabaseInstance. The + SAPDatabaseInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param resource: Request body of Database resource of a SAP system. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPDatabaseInstance. The + SAPDatabaseInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param resource: Request body of Database resource of a SAP system. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPDatabaseInstance. The + SAPDatabaseInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + resource: Union[_models.SAPDatabaseInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param resource: Request body of Database resource of a SAP system. Is one of the following + types: SAPDatabaseInstance, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns SAPDatabaseInstance. The + SAPDatabaseInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SAPDatabaseInstance, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SAPDatabaseInstance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SAPDatabaseInstance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + properties: _models.UpdateSAPDatabaseInstanceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param properties: Database resource update request body. Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPDatabaseInstanceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPDatabaseInstance. The SAPDatabaseInstance is compatible with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param properties: Database resource update request body. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPDatabaseInstance. The SAPDatabaseInstance is compatible with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param properties: Database resource update request body. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPDatabaseInstance. The SAPDatabaseInstance is compatible with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + properties: Union[_models.UpdateSAPDatabaseInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param properties: Database resource update request body. Is one of the following types: + UpdateSAPDatabaseInstanceRequest, JSON, IO[bytes] Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPDatabaseInstanceRequest or JSON or + IO[bytes] + :return: SAPDatabaseInstance. The SAPDatabaseInstance is compatible with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_database_instances_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPDatabaseInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_sap_database_instances_delete_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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[None]: + """Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. + <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SAPDatabaseInstance"]: + """Lists the Database resources associated with a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :return: An iterator like instance of SAPDatabaseInstance + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SAPDatabaseInstance]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_sap_database_instances_list_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SAPDatabaseInstance], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _start_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_database_instances_start_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Is one of the following types: + StartRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _stop_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_database_instances_stop_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Is one of the following + types: StopRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class SAPApplicationServerInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloadssapvirtualinstance.aio.WorkloadsSapVirtualInstanceMgmtClient`'s + :attr:`sap_application_server_instances` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Gets the SAP Application Server Instance corresponding to the Virtual Instance for SAP + solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :return: SAPApplicationServerInstance. The SAPApplicationServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) + + _request = build_sap_application_server_instances_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPApplicationServerInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + resource: Union[_models.SAPApplicationServerInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_application_server_instances_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + resource: _models.SAPApplicationServerInstance, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param resource: The SAP Application Server Instance resource request body. Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPApplicationServerInstance. The + SAPApplicationServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param resource: The SAP Application Server Instance resource request body. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPApplicationServerInstance. The + SAPApplicationServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param resource: The SAP Application Server Instance resource request body. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SAPApplicationServerInstance. The + SAPApplicationServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + resource: Union[_models.SAPApplicationServerInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param resource: The SAP Application Server Instance resource request body. Is one of the + following types: SAPApplicationServerInstance, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns SAPApplicationServerInstance. The + SAPApplicationServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SAPApplicationServerInstance, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SAPApplicationServerInstance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SAPApplicationServerInstance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + properties: _models.UpdateSAPApplicationInstanceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Puts the SAP Application Server Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param properties: The SAP Application Server Instance resource request body. Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPApplicationInstanceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPApplicationServerInstance. The SAPApplicationServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Puts the SAP Application Server Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param properties: The SAP Application Server Instance resource request body. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPApplicationServerInstance. The SAPApplicationServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Puts the SAP Application Server Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param properties: The SAP Application Server Instance resource request body. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPApplicationServerInstance. The SAPApplicationServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + properties: Union[_models.UpdateSAPApplicationInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Puts the SAP Application Server Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param properties: The SAP Application Server Instance resource request body. Is one of the + following types: UpdateSAPApplicationInstanceRequest, JSON, IO[bytes] Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPApplicationInstanceRequest or JSON or + IO[bytes] + :return: SAPApplicationServerInstance. The SAPApplicationServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_application_server_instances_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPApplicationServerInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_sap_application_server_instances_delete_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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[None]: + """Deletes the SAP Application Server Instance resource. <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SAPApplicationServerInstance"]: + # pylint: disable=line-too-long + """Lists the SAP Application Server Instance resources for a given Virtual Instance for SAP + solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :return: An iterator like instance of SAPApplicationServerInstance + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SAPApplicationServerInstance]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_sap_application_server_instances_list_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SAPApplicationServerInstance], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _start_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_application_server_instances_start_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Is one of the following types: + StartRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _stop_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_application_server_instances_stop_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Is one of the following types: + StopRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationStatusResult. The + OperationStatusResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_sap_application_server_instances_operations.py deleted file mode 100644 index 461f46249ee15..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_sap_application_server_instances_operations.py +++ /dev/null @@ -1,1289 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._sap_application_server_instances_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_start_instance_request, - build_stop_instance_request, - build_update_request, -) -from .._vendor import WorkloadsSapVirtualInstanceMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SAPApplicationServerInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.workloadssapvirtualinstance.aio.WorkloadsSapVirtualInstanceMgmtClient`'s - :attr:`sap_application_server_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any - ) -> _models.SAPApplicationServerInstance: - """Gets the SAP Application Server Instance corresponding to the Virtual Instance for SAP - solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :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.workloadssapvirtualinstance.models.SAPApplicationServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}" - } - - async def _create_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.SAPApplicationServerInstance, IO]] = None, - **kwargs: Any - ) -> _models.SAPApplicationServerInstance: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "SAPApplicationServerInstance") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, 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, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" - } - - @overload - async def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[_models.SAPApplicationServerInstance] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPApplicationServerInstance]: - """Puts the SAP Application Server Instance resource. :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: The SAP Application Server Instance resource request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPApplicationServerInstance or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPApplicationServerInstance]: - """Puts the SAP Application Server Instance resource. :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: The SAP Application Server Instance resource request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPApplicationServerInstance or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.SAPApplicationServerInstance, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPApplicationServerInstance]: - """Puts the SAP Application Server Instance resource. :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: The SAP Application Server Instance resource request body. Is either a - SAPApplicationServerInstance type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPApplicationServerInstance or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" - } - - @overload - async def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[_models.UpdateSAPApplicationInstanceRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPApplicationServerInstance: - """Updates the SAP Application server instance resource. This can be used to update tags on the - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: The SAP Application Server Instance resource request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPApplicationInstanceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPApplicationServerInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPApplicationServerInstance: - """Updates the SAP Application server instance resource. This can be used to update tags on the - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: The SAP Application Server Instance resource request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPApplicationServerInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.UpdateSAPApplicationInstanceRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPApplicationServerInstance: - """Updates the SAP Application server instance resource. This can be used to update tags on the - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: The SAP Application Server Instance resource request body. Is either a - UpdateSAPApplicationInstanceRequest type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPApplicationInstanceRequest - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPApplicationServerInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "UpdateSAPApplicationInstanceRequest") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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 - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 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) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes the SAP Application Server Instance resource. :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SAPApplicationServerInstance"]: - """Lists the SAP Application Server Instance resources for a given Virtual Instance for SAP - solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :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 SAPApplicationServerInstance or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPApplicationServerInstanceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SAPApplicationServerInstanceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - async def _start_instance_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StartRequest") - else: - _json = None - - request = build_start_instance_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._start_instance_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _start_instance_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" - } - - @overload - async def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[_models.StartRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Starts the SAP Application Server Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: SAP Application server instance start request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Starts the SAP Application Server Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: SAP Application server instance start request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Starts the SAP Application Server Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: SAP Application server instance start request body. Is either a StartRequest type - or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_instance_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" - } - - async def _stop_instance_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StopRequest") - else: - _json = None - - request = build_stop_instance_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._stop_instance_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _stop_instance_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" - } - - @overload - async def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[_models.StopRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Stops the SAP Application Server Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: SAP Application server instance stop request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Stops the SAP Application Server Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: SAP Application server instance stop request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Stops the SAP Application Server Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: SAP Application server instance stop request body. Is either a StopRequest type or - a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_instance_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" - } diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_sap_central_instances_operations.py deleted file mode 100644 index e0269412041ae..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_sap_central_instances_operations.py +++ /dev/null @@ -1,1290 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._sap_central_instances_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_start_instance_request, - build_stop_instance_request, - build_update_request, -) -from .._vendor import WorkloadsSapVirtualInstanceMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SAPCentralInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.workloadssapvirtualinstance.aio.WorkloadsSapVirtualInstanceMgmtClient`'s - :attr:`sap_central_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any - ) -> _models.SAPCentralServerInstance: - """Gets the SAP Central Services Instance resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :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.workloadssapvirtualinstance.models.SAPCentralServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}" - } - - async def _create_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.SAPCentralServerInstance, IO]] = None, - **kwargs: Any - ) -> _models.SAPCentralServerInstance: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "SAPCentralServerInstance") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, 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, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" - } - - @overload - async def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[_models.SAPCentralServerInstance] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPCentralServerInstance]: - """Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used - by service only. PUT operation on this resource by end user will return a Bad Request error. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: The SAP Central Services Instance request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPCentralServerInstance or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPCentralServerInstance]: - """Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used - by service only. PUT operation on this resource by end user will return a Bad Request error. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: The SAP Central Services Instance request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPCentralServerInstance or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.SAPCentralServerInstance, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPCentralServerInstance]: - """Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used - by service only. PUT operation on this resource by end user will return a Bad Request error. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: The SAP Central Services Instance request body. Is either a - SAPCentralServerInstance type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPCentralServerInstance or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" - } - - @overload - async def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[_models.UpdateSAPCentralInstanceRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPCentralServerInstance: - """Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to - update tags on the resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: The SAP Central Services Instance resource request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPCentralInstanceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPCentralServerInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPCentralServerInstance: - """Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to - update tags on the resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: The SAP Central Services Instance resource request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPCentralServerInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.UpdateSAPCentralInstanceRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPCentralServerInstance: - """Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to - update tags on the resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: The SAP Central Services Instance resource request body. Is either a - UpdateSAPCentralInstanceRequest type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPCentralInstanceRequest or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPCentralServerInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "UpdateSAPCentralInstanceRequest") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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 - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 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) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used - by service only. Delete operation on this resource by end user will return a Bad Request error. - You can delete the parent resource, which is the Virtual Instance for SAP solutions resource, - using the delete operation on it. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SAPCentralServerInstance"]: - """Lists the SAP Central Services Instance resource for the given Virtual Instance for SAP - solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :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 SAPCentralServerInstance or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPCentralInstanceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SAPCentralInstanceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - async def _start_instance_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StartRequest") - else: - _json = None - - request = build_start_instance_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._start_instance_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _start_instance_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" - } - - @overload - async def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[_models.StartRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Starts the SAP Central Services Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: SAP Central Services instance start request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Starts the SAP Central Services Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: SAP Central Services instance start request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Starts the SAP Central Services Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: SAP Central Services instance start request body. Is either a StartRequest type or - a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_instance_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" - } - - async def _stop_instance_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StopRequest") - else: - _json = None - - request = build_stop_instance_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._stop_instance_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _stop_instance_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" - } - - @overload - async def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[_models.StopRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Stops the SAP Central Services Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: SAP Central Services instance stop request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Stops the SAP Central Services Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: SAP Central Services instance stop request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Stops the SAP Central Services Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: SAP Central Services instance stop request body. Is either a StopRequest type or a - IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_instance_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" - } diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_sap_database_instances_operations.py deleted file mode 100644 index 2be63786c3dce..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_sap_database_instances_operations.py +++ /dev/null @@ -1,1287 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._sap_database_instances_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_start_instance_request, - build_stop_instance_request, - build_update_request, -) -from .._vendor import WorkloadsSapVirtualInstanceMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SAPDatabaseInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.workloadssapvirtualinstance.aio.WorkloadsSapVirtualInstanceMgmtClient`'s - :attr:`sap_database_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any - ) -> _models.SAPDatabaseInstance: - """Gets the SAP Database Instance resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :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.workloadssapvirtualinstance.models.SAPDatabaseInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}" - } - - async def _create_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.SAPDatabaseInstance, IO]] = None, - **kwargs: Any - ) -> _models.SAPDatabaseInstance: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "SAPDatabaseInstance") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, 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, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" - } - - @overload - async def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[_models.SAPDatabaseInstance] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPDatabaseInstance]: - """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. - :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Request body of Database resource of a SAP system. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPDatabaseInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPDatabaseInstance]: - """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. - :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Request body of Database resource of a SAP system. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPDatabaseInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.SAPDatabaseInstance, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPDatabaseInstance]: - """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. - :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Request body of Database resource of a SAP system. Is either a SAPDatabaseInstance - type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPDatabaseInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" - } - - @overload - async def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[_models.UpdateSAPDatabaseInstanceRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPDatabaseInstance: - """Updates the Database instance resource. This can be used to update tags on the resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Database resource update request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPDatabaseInstanceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPDatabaseInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPDatabaseInstance: - """Updates the Database instance resource. This can be used to update tags on the resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Database resource update request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPDatabaseInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.UpdateSAPDatabaseInstanceRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPDatabaseInstance: - """Updates the Database instance resource. This can be used to update tags on the resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Database resource update request body. Is either a - UpdateSAPDatabaseInstanceRequest type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPDatabaseInstanceRequest or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPDatabaseInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "UpdateSAPDatabaseInstanceRequest") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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 - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 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) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. - :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SAPDatabaseInstance"]: - """Lists the Database resources associated with a Virtual Instance for SAP solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :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 SAPDatabaseInstance or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPDatabaseInstanceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SAPDatabaseInstanceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - async def _start_instance_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StartRequest") - else: - _json = None - - request = build_start_instance_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._start_instance_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _start_instance_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" - } - - @overload - async def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[_models.StartRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Starts the database instance of the SAP system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: SAP Database server instance start request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Starts the database instance of the SAP system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: SAP Database server instance start request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Starts the database instance of the SAP system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: SAP Database server instance start request body. Is either a StartRequest type or - a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_instance_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" - } - - async def _stop_instance_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StopRequest") - else: - _json = None - - request = build_stop_instance_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._stop_instance_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _stop_instance_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" - } - - @overload - async def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[_models.StopRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Stops the database instance of the SAP system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Stop request for the database instance of the SAP system. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Stops the database instance of the SAP system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Stop request for the database instance of the SAP system. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Stops the database instance of the SAP system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Stop request for the database instance of the SAP system. Is either a StopRequest - type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_instance_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" - } diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_sap_virtual_instances_operations.py deleted file mode 100644 index 8d55876e7bd5b..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_sap_virtual_instances_operations.py +++ /dev/null @@ -1,1397 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._sap_virtual_instances_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_start_request, - build_stop_request, - build_update_request, -) -from .._vendor import WorkloadsSapVirtualInstanceMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SAPVirtualInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.workloadssapvirtualinstance.aio.WorkloadsSapVirtualInstanceMgmtClient`'s - :attr:`sap_virtual_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _create_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.SAPVirtualInstance, IO]] = None, - **kwargs: Any - ) -> _models.SAPVirtualInstance: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "SAPVirtualInstance") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, 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, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" - } - - @overload - async def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[_models.SAPVirtualInstance] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPVirtualInstance]: - """Creates a Virtual Instance for SAP solutions (VIS) resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: Virtual Instance for SAP solutions resource request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPVirtualInstance]: - """Creates a Virtual Instance for SAP solutions (VIS) resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: Virtual Instance for SAP solutions resource request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.SAPVirtualInstance, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPVirtualInstance]: - """Creates a Virtual Instance for SAP solutions (VIS) resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: Virtual Instance for SAP solutions resource request body. Is either a - SAPVirtualInstance type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> _models.SAPVirtualInstance: - """Gets a Virtual Instance for SAP solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :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.workloadssapvirtualinstance.models.SAPVirtualInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}" - } - - async def _update_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.UpdateSAPVirtualInstanceRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPVirtualInstance: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "UpdateSAPVirtualInstanceRequest") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" - } - - @overload - async def begin_update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[_models.UpdateSAPVirtualInstanceRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPVirtualInstance]: - """Updates a Virtual Instance for SAP solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: Request body to update a Virtual Instance for SAP solutions resource. Default - value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPVirtualInstanceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPVirtualInstance]: - """Updates a Virtual Instance for SAP solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: Request body to update a Virtual Instance for SAP solutions resource. Default - value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.UpdateSAPVirtualInstanceRequest, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.SAPVirtualInstance]: - """Updates a Virtual Instance for SAP solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: Request body to update a Virtual Instance for SAP solutions resource. Is either a - UpdateSAPVirtualInstanceRequest type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPVirtualInstanceRequest or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 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) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a Virtual Instance for SAP solutions resource and its child resources, that is the - associated Central Services Instance, Application Server Instances and Database Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SAPVirtualInstance"]: - """Gets all Virtual Instances for SAP solutions resources in a Resource Group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :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 SAPVirtualInstance or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPVirtualInstanceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SAPVirtualInstanceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SAPVirtualInstance"]: - """Gets all Virtual Instances for SAP solutions resources in a Subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SAPVirtualInstance or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPVirtualInstanceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SAPVirtualInstanceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - async def _start_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StartRequest") - else: - _json = None - - request = build_start_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._start_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start" - } - - @overload - async def begin_start( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[_models.StartRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Starts the SAP application, that is the Central Services instance and Application server - instances. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: The Virtual Instance for SAP solutions resource start request body. Default value - is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_start( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Starts the SAP application, that is the Central Services instance and Application server - instances. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: The Virtual Instance for SAP solutions resource start request body. Default value - is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_start( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Starts the SAP application, that is the Central Services instance and Application server - instances. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: The Virtual Instance for SAP solutions resource start request body. Is either a - StartRequest type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start" - } - - async def _stop_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StopRequest") - else: - _json = None - - request = build_stop_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._stop_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop" - } - - @overload - async def begin_stop( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[_models.StopRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Stops the SAP Application, that is the Application server instances and Central Services - instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: The Virtual Instance for SAP solutions resource stop request body. Default value - is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_stop( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Stops the SAP Application, that is the Application server instances and Central Services - instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: The Virtual Instance for SAP solutions resource stop request body. Default value - is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_stop( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationStatusResult]: - """Stops the SAP Application, that is the Application server instances and Central Services - instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: The Virtual Instance for SAP solutions resource stop request body. Is either a - StopRequest type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop" - } diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_workloads_sap_virtual_instance_mgmt_client_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_workloads_sap_virtual_instance_mgmt_client_operations.py deleted file mode 100644 index 8697e64ebf5ce..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/aio/operations/_workloads_sap_virtual_instance_mgmt_client_operations.py +++ /dev/null @@ -1,586 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._workloads_sap_virtual_instance_mgmt_client_operations import ( - build_sap_availability_zone_details_request, - build_sap_disk_configurations_request, - build_sap_sizing_recommendations_request, - build_sap_supported_sku_request, -) -from .._vendor import WorkloadsSapVirtualInstanceMgmtClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class WorkloadsSapVirtualInstanceMgmtClientOperationsMixin(WorkloadsSapVirtualInstanceMgmtClientMixinABC): - @overload - async def sap_sizing_recommendations( - self, - location: str, - sap_sizing_recommendation: Optional[_models.SAPSizingRecommendationRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPSizingRecommendationResult: - """Get SAP sizing recommendations by providing input SAPS for application tier and memory required - for database tier. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is - None. - :type sap_sizing_recommendation: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPSizingRecommendationResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def sap_sizing_recommendations( - self, - location: str, - sap_sizing_recommendation: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPSizingRecommendationResult: - """Get SAP sizing recommendations by providing input SAPS for application tier and memory required - for database tier. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is - None. - :type sap_sizing_recommendation: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPSizingRecommendationResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def sap_sizing_recommendations( - self, - location: str, - sap_sizing_recommendation: Optional[Union[_models.SAPSizingRecommendationRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPSizingRecommendationResult: - """Get SAP sizing recommendations by providing input SAPS for application tier and memory required - for database tier. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Is either a - SAPSizingRecommendationRequest type or a IO type. Default value is None. - :type sap_sizing_recommendation: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPSizingRecommendationResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPSizingRecommendationResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(sap_sizing_recommendation, (IOBase, bytes)): - _content = sap_sizing_recommendation - else: - if sap_sizing_recommendation is not None: - _json = self._serialize.body(sap_sizing_recommendation, "SAPSizingRecommendationRequest") - else: - _json = None - - request = build_sap_sizing_recommendations_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.sap_sizing_recommendations.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - @overload - async def sap_supported_sku( - self, - location: str, - sap_supported_sku: Optional[_models.SAPSupportedSkusRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPSupportedResourceSkusResult: - """Get a list of SAP supported SKUs for ASCS, Application and Database tier. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_supported_sku: SAP Supported SKU Request body. Default value is None. - :type sap_supported_sku: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedSkusRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPSupportedResourceSkusResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def sap_supported_sku( - self, - location: str, - sap_supported_sku: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPSupportedResourceSkusResult: - """Get a list of SAP supported SKUs for ASCS, Application and Database tier. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_supported_sku: SAP Supported SKU Request body. Default value is None. - :type sap_supported_sku: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPSupportedResourceSkusResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def sap_supported_sku( - self, - location: str, - sap_supported_sku: Optional[Union[_models.SAPSupportedSkusRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPSupportedResourceSkusResult: - """Get a list of SAP supported SKUs for ASCS, Application and Database tier. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_supported_sku: SAP Supported SKU Request body. Is either a SAPSupportedSkusRequest - type or a IO type. Default value is None. - :type sap_supported_sku: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedSkusRequest - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPSupportedResourceSkusResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPSupportedResourceSkusResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(sap_supported_sku, (IOBase, bytes)): - _content = sap_supported_sku - else: - if sap_supported_sku is not None: - _json = self._serialize.body(sap_supported_sku, "SAPSupportedSkusRequest") - else: - _json = None - - request = build_sap_supported_sku_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.sap_supported_sku.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - @overload - async def sap_disk_configurations( - self, - location: str, - sap_disk_configurations: Optional[_models.SAPDiskConfigurationsRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPDiskConfigurationsResult: - """Get the SAP Disk Configuration Layout prod/non-prod SAP System. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_disk_configurations: SAP Disk Configurations Request body. Default value is None. - :type sap_disk_configurations: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPDiskConfigurationsResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def sap_disk_configurations( - self, - location: str, - sap_disk_configurations: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPDiskConfigurationsResult: - """Get the SAP Disk Configuration Layout prod/non-prod SAP System. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_disk_configurations: SAP Disk Configurations Request body. Default value is None. - :type sap_disk_configurations: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPDiskConfigurationsResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def sap_disk_configurations( - self, - location: str, - sap_disk_configurations: Optional[Union[_models.SAPDiskConfigurationsRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPDiskConfigurationsResult: - """Get the SAP Disk Configuration Layout prod/non-prod SAP System. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_disk_configurations: SAP Disk Configurations Request body. Is either a - SAPDiskConfigurationsRequest type or a IO type. Default value is None. - :type sap_disk_configurations: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPDiskConfigurationsResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPDiskConfigurationsResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(sap_disk_configurations, (IOBase, bytes)): - _content = sap_disk_configurations - else: - if sap_disk_configurations is not None: - _json = self._serialize.body(sap_disk_configurations, "SAPDiskConfigurationsRequest") - else: - _json = None - - request = build_sap_disk_configurations_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.sap_disk_configurations.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - @overload - async def sap_availability_zone_details( - self, - location: str, - sap_availability_zone_details: Optional[_models.SAPAvailabilityZoneDetailsRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPAvailabilityZoneDetailsResult: - """Get the recommended SAP Availability Zone Pair Details for your region. - - :param location: The name of Azure region. Required. - :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.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPAvailabilityZoneDetailsResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def sap_availability_zone_details( - self, - location: str, - sap_availability_zone_details: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPAvailabilityZoneDetailsResult: - """Get the recommended SAP Availability Zone Pair Details for your region. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_availability_zone_details: SAP Availability Zone Details Request body. Default value - is None. - :type sap_availability_zone_details: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPAvailabilityZoneDetailsResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def sap_availability_zone_details( - self, - location: str, - sap_availability_zone_details: Optional[Union[_models.SAPAvailabilityZoneDetailsRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPAvailabilityZoneDetailsResult: - """Get the recommended SAP Availability Zone Pair Details for your region. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_availability_zone_details: SAP Availability Zone Details Request body. Is either a - SAPAvailabilityZoneDetailsRequest type or a IO type. Default value is None. - :type sap_availability_zone_details: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPAvailabilityZoneDetailsResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPAvailabilityZoneDetailsResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(sap_availability_zone_details, (IOBase, bytes)): - _content = sap_availability_zone_details - else: - 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( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.sap_availability_zone_details.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/__init__.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/__init__.py index 91821ad8304ed..0f6c876e85522 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/__init__.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/__init__.py @@ -2,141 +2,147 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import ApplicationServerConfiguration -from ._models_py3 import ApplicationServerFullResourceNames -from ._models_py3 import ApplicationServerVmDetails -from ._models_py3 import CentralServerConfiguration -from ._models_py3 import CentralServerFullResourceNames -from ._models_py3 import CentralServerVmDetails -from ._models_py3 import CreateAndMountFileShareConfiguration -from ._models_py3 import DatabaseConfiguration -from ._models_py3 import DatabaseServerFullResourceNames -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 DiskConfiguration -from ._models_py3 import DiskDetails -from ._models_py3 import DiskSku -from ._models_py3 import DiskVolumeConfiguration -from ._models_py3 import EnqueueReplicationServerProperties -from ._models_py3 import EnqueueServerProperties -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDefinition -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import ExternalInstallationSoftwareConfiguration -from ._models_py3 import FileShareConfiguration -from ._models_py3 import GatewayServerProperties -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 LoadBalancerDetails -from ._models_py3 import LoadBalancerResourceNames -from ._models_py3 import ManagedRGConfiguration -from ._models_py3 import MessageServerProperties -from ._models_py3 import MountFileShareConfiguration -from ._models_py3 import NetworkConfiguration -from ._models_py3 import NetworkInterfaceResourceNames -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 OsSapConfiguration -from ._models_py3 import Resource -from ._models_py3 import SAPApplicationServerInstance -from ._models_py3 import SAPApplicationServerInstanceList -from ._models_py3 import SAPApplicationServerProperties -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 SAPCentralServerProperties -from ._models_py3 import SAPConfiguration -from ._models_py3 import SAPDatabaseInstance -from ._models_py3 import SAPDatabaseInstanceList -from ._models_py3 import SAPDatabaseProperties -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 SAPVirtualInstanceProperties -from ._models_py3 import ServiceInitiatedSoftwareConfiguration -from ._models_py3 import SharedStorageResourceNames -from ._models_py3 import SingleServerConfiguration -from ._models_py3 import SingleServerCustomResourceNames -from ._models_py3 import SingleServerFullResourceNames -from ._models_py3 import SingleServerRecommendationResult -from ._models_py3 import SkipFileShareConfiguration -from ._models_py3 import SoftwareConfiguration -from ._models_py3 import SshConfiguration -from ._models_py3 import SshKeyPair -from ._models_py3 import SshPublicKey -from ._models_py3 import StartRequest -from ._models_py3 import StopRequest -from ._models_py3 import StorageConfiguration -from ._models_py3 import StorageInformation -from ._models_py3 import SystemData -from ._models_py3 import ThreeTierConfiguration -from ._models_py3 import ThreeTierCustomResourceNames -from ._models_py3 import ThreeTierFullResourceNames -from ._models_py3 import ThreeTierRecommendationResult -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateSAPApplicationInstanceRequest -from ._models_py3 import UpdateSAPCentralInstanceRequest -from ._models_py3 import UpdateSAPDatabaseInstanceRequest -from ._models_py3 import UpdateSAPVirtualInstanceProperties -from ._models_py3 import UpdateSAPVirtualInstanceRequest -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import UserAssignedServiceIdentity -from ._models_py3 import VirtualMachineConfiguration -from ._models_py3 import VirtualMachineResourceNames -from ._models_py3 import WindowsConfiguration +from typing import TYPE_CHECKING -from ._workloads_sap_virtual_instance_mgmt_client_enums import ActionType -from ._workloads_sap_virtual_instance_mgmt_client_enums import ApplicationServerVirtualMachineType -from ._workloads_sap_virtual_instance_mgmt_client_enums import CentralServerVirtualMachineType -from ._workloads_sap_virtual_instance_mgmt_client_enums import ConfigurationType -from ._workloads_sap_virtual_instance_mgmt_client_enums import CreatedByType -from ._workloads_sap_virtual_instance_mgmt_client_enums import DiskSkuName -from ._workloads_sap_virtual_instance_mgmt_client_enums import EnqueueReplicationServerType -from ._workloads_sap_virtual_instance_mgmt_client_enums import ManagedResourcesNetworkAccessType -from ._workloads_sap_virtual_instance_mgmt_client_enums import ManagedServiceIdentityType -from ._workloads_sap_virtual_instance_mgmt_client_enums import NamingPatternType -from ._workloads_sap_virtual_instance_mgmt_client_enums import OSType -from ._workloads_sap_virtual_instance_mgmt_client_enums import Origin -from ._workloads_sap_virtual_instance_mgmt_client_enums import SAPConfigurationType -from ._workloads_sap_virtual_instance_mgmt_client_enums import SAPDatabaseScaleMethod -from ._workloads_sap_virtual_instance_mgmt_client_enums import SAPDatabaseType -from ._workloads_sap_virtual_instance_mgmt_client_enums import SAPDeploymentType -from ._workloads_sap_virtual_instance_mgmt_client_enums import SAPEnvironmentType -from ._workloads_sap_virtual_instance_mgmt_client_enums import SAPHealthState -from ._workloads_sap_virtual_instance_mgmt_client_enums import SAPHighAvailabilityType -from ._workloads_sap_virtual_instance_mgmt_client_enums import SAPProductType -from ._workloads_sap_virtual_instance_mgmt_client_enums import SAPSoftwareInstallationType -from ._workloads_sap_virtual_instance_mgmt_client_enums import SAPVirtualInstanceState -from ._workloads_sap_virtual_instance_mgmt_client_enums import SAPVirtualInstanceStatus -from ._workloads_sap_virtual_instance_mgmt_client_enums import SapVirtualInstanceProvisioningState +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + ApplicationServerConfiguration, + ApplicationServerFullResourceNames, + ApplicationServerVmDetails, + CentralServerConfiguration, + CentralServerFullResourceNames, + CentralServerVmDetails, + CreateAndMountFileShareConfiguration, + DatabaseConfiguration, + DatabaseServerFullResourceNames, + DatabaseVmDetails, + DeployerVmPackages, + DeploymentConfiguration, + DeploymentWithOSConfiguration, + DiscoveryConfiguration, + DiskConfiguration, + DiskDetails, + DiskSku, + DiskVolumeConfiguration, + EnqueueReplicationServerProperties, + EnqueueServerProperties, + ErrorAdditionalInfo, + ErrorDefinition, + ErrorDetail, + ErrorResponse, + ExternalInstallationSoftwareConfiguration, + FileShareConfiguration, + GatewayServerProperties, + HighAvailabilityConfiguration, + HighAvailabilitySoftwareConfiguration, + ImageReference, + InfrastructureConfiguration, + LinuxConfiguration, + LoadBalancerDetails, + LoadBalancerResourceNames, + ManagedRGConfiguration, + MessageServerProperties, + MountFileShareConfiguration, + NetworkConfiguration, + NetworkInterfaceResourceNames, + OSConfiguration, + OSProfile, + Operation, + OperationDisplay, + OperationStatusResult, + OsSapConfiguration, + Resource, + SAPApplicationServerInstance, + SAPApplicationServerProperties, + SAPAvailabilityZoneDetailsRequest, + SAPAvailabilityZoneDetailsResult, + SAPAvailabilityZonePair, + SAPCentralServerInstance, + SAPCentralServerProperties, + SAPConfiguration, + SAPDatabaseInstance, + SAPDatabaseProperties, + SAPDiskConfiguration, + SAPDiskConfigurationsRequest, + SAPDiskConfigurationsResult, + SAPInstallWithoutOSConfigSoftwareConfiguration, + SAPSizingRecommendationRequest, + SAPSizingRecommendationResult, + SAPSupportedResourceSkusResult, + SAPSupportedSku, + SAPSupportedSkusRequest, + SAPVirtualInstance, + SAPVirtualInstanceError, + SAPVirtualInstanceIdentity, + SAPVirtualInstanceProperties, + ServiceInitiatedSoftwareConfiguration, + SharedStorageResourceNames, + SingleServerConfiguration, + SingleServerCustomResourceNames, + SingleServerFullResourceNames, + SingleServerRecommendationResult, + SkipFileShareConfiguration, + SoftwareConfiguration, + SshConfiguration, + SshKeyPair, + SshPublicKey, + StartRequest, + StopRequest, + StorageConfiguration, + StorageInformation, + SystemData, + ThreeTierConfiguration, + ThreeTierCustomResourceNames, + ThreeTierFullResourceNames, + ThreeTierRecommendationResult, + TrackedResource, + UpdateSAPApplicationInstanceRequest, + UpdateSAPCentralInstanceRequest, + UpdateSAPDatabaseInstanceRequest, + UpdateSAPVirtualInstanceProperties, + UpdateSAPVirtualInstanceRequest, + UserAssignedIdentity, + VirtualMachineConfiguration, + VirtualMachineResourceNames, + WindowsConfiguration, +) + +from ._enums import ( # type: ignore + ActionType, + ApplicationServerVirtualMachineType, + CentralServerVirtualMachineType, + CreatedByType, + DiskSkuName, + EnqueueReplicationServerType, + FileShareConfigurationType, + ManagedResourcesNetworkAccessType, + NamingPatternType, + OSType, + Origin, + SAPConfigurationType, + SAPDatabaseScaleMethod, + SAPDatabaseType, + SAPDeploymentType, + SAPEnvironmentType, + SAPHealthState, + SAPHighAvailabilityType, + SAPProductType, + SAPSoftwareInstallationType, + SAPVirtualInstanceIdentityType, + SAPVirtualInstanceState, + SAPVirtualInstanceStatus, + SapVirtualInstanceProvisioningState, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -183,22 +189,18 @@ "OSProfile", "Operation", "OperationDisplay", - "OperationListResult", "OperationStatusResult", "OsSapConfiguration", "Resource", "SAPApplicationServerInstance", - "SAPApplicationServerInstanceList", "SAPApplicationServerProperties", "SAPAvailabilityZoneDetailsRequest", "SAPAvailabilityZoneDetailsResult", "SAPAvailabilityZonePair", - "SAPCentralInstanceList", "SAPCentralServerInstance", "SAPCentralServerProperties", "SAPConfiguration", "SAPDatabaseInstance", - "SAPDatabaseInstanceList", "SAPDatabaseProperties", "SAPDiskConfiguration", "SAPDiskConfigurationsRequest", @@ -211,7 +213,7 @@ "SAPSupportedSkusRequest", "SAPVirtualInstance", "SAPVirtualInstanceError", - "SAPVirtualInstanceList", + "SAPVirtualInstanceIdentity", "SAPVirtualInstanceProperties", "ServiceInitiatedSoftwareConfiguration", "SharedStorageResourceNames", @@ -240,19 +242,17 @@ "UpdateSAPVirtualInstanceProperties", "UpdateSAPVirtualInstanceRequest", "UserAssignedIdentity", - "UserAssignedServiceIdentity", "VirtualMachineConfiguration", "VirtualMachineResourceNames", "WindowsConfiguration", "ActionType", "ApplicationServerVirtualMachineType", "CentralServerVirtualMachineType", - "ConfigurationType", "CreatedByType", "DiskSkuName", "EnqueueReplicationServerType", + "FileShareConfigurationType", "ManagedResourcesNetworkAccessType", - "ManagedServiceIdentityType", "NamingPatternType", "OSType", "Origin", @@ -265,9 +265,10 @@ "SAPHighAvailabilityType", "SAPProductType", "SAPSoftwareInstallationType", + "SAPVirtualInstanceIdentityType", "SAPVirtualInstanceState", "SAPVirtualInstanceStatus", "SapVirtualInstanceProvisioningState", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/_workloads_sap_virtual_instance_mgmt_client_enums.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/_enums.py similarity index 58% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/_workloads_sap_virtual_instance_mgmt_client_enums.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/_enums.py index bdcd6e2f11b43..638dcfd55333a 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/_workloads_sap_virtual_instance_mgmt_client_enums.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -11,85 +11,110 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ INTERNAL = "Internal" + """Actions are for internal-only APIs.""" class ApplicationServerVirtualMachineType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the type of application server VM.""" ACTIVE = "Active" + """Active Application server vm type.""" STANDBY = "Standby" + """Standby Application server vm type.""" UNKNOWN = "Unknown" + """Unknown Application server vm type.""" class CentralServerVirtualMachineType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the type of central server VM.""" PRIMARY = "Primary" + """Primary central server vm.""" SECONDARY = "Secondary" + """Secondary central server vm.""" UNKNOWN = "Unknown" + """Central server vm type unknown.""" ASCS = "ASCS" + """ASCS Central server vm type.""" ERS_INACTIVE = "ERSInactive" + """ERSInactive Central server vm type.""" ERS = "ERS" + """ERS Central server vm type.""" STANDBY = "Standby" - - -class ConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of file share config.""" - - SKIP = "Skip" - CREATE_AND_MOUNT = "CreateAndMount" - MOUNT = "Mount" + """Standby Central server vm type.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" + """The kind of entity that created the resource.""" USER = "User" + """The entity was created by a user.""" APPLICATION = "Application" + """The entity was created by an application.""" MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" KEY = "Key" + """The entity was created by a key.""" class DiskSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the disk sku name.""" STANDARD_LRS = "Standard_LRS" + """Standard LRS Disk SKU.""" PREMIUM_LRS = "Premium_LRS" + """Premium_LRS Disk SKU.""" STANDARD_SSD_LRS = "StandardSSD_LRS" + """StandardSSD_LRS Disk SKU.""" ULTRA_SSD_LRS = "UltraSSD_LRS" + """UltraSSD_LRS Disk SKU.""" PREMIUM_ZRS = "Premium_ZRS" + """Premium_ZRS Disk SKU.""" STANDARD_SSD_ZRS = "StandardSSD_ZRS" + """StandardSSD_ZRS Disk SKU.""" PREMIUM_V2_LRS = "PremiumV2_LRS" + """PremiumV2_LRS Disk SKU.""" class EnqueueReplicationServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the type of Enqueue Replication Server.""" ENQUEUE_REPLICATOR1 = "EnqueueReplicator1" + """Enqueue Replication server type 1.""" ENQUEUE_REPLICATOR2 = "EnqueueReplicator2" + """Enqueue Replication server type 2.""" + + +class FileShareConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of file share config.""" + + SKIP = "Skip" + """Skip creating the file share.""" + CREATE_AND_MOUNT = "CreateAndMount" + """Fileshare will be created and mounted by service.""" + MOUNT = "Mount" + """Existing fileshare provided will be mounted by service.""" class ManagedResourcesNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the network access type for managed resources.""" PUBLIC = "Public" + """Managed resources will be deployed with public network access enabled.""" PRIVATE = "Private" - - -class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (only None, UserAssigned types are allowed).""" - - NONE = "None" - USER_ASSIGNED = "UserAssigned" + """Managed resources will be deployed with public network access disabled.""" class NamingPatternType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The pattern type to be used for resource naming.""" FULL_RESOURCE_NAME = "FullResourceName" + """Full resource names that will be created by service.""" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -98,120 +123,182 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ USER = "user" + """Indicates the operation is initiated by a user.""" SYSTEM = "system" + """Indicates the operation is initiated by a system.""" USER_SYSTEM = "user,system" + """Indicates the operation is initiated by a user or system.""" class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The OS Type.""" LINUX = "Linux" + """Linux OS Type.""" WINDOWS = "Windows" + """Windows OS Type.""" class SAPConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The configuration Type.""" DEPLOYMENT = "Deployment" + """SAP system will be deployed by service. No OS configurations will be done.""" DISCOVERY = "Discovery" + """Existing SAP system will be registered.""" DEPLOYMENT_WITH_OS_CONFIG = "DeploymentWithOSConfig" + """SAP system will be deployed by service. OS configurations will be done.""" class SAPDatabaseScaleMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The database scale method.""" SCALE_UP = "ScaleUp" + """ScaleUp Hana Database deployment type""" class SAPDatabaseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the supported SAP Database types.""" HANA = "HANA" + """HANA Database type of SAP system.""" DB2 = "DB2" + """DB2 database type of the SAP system.""" class SAPDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of SAP deployment, single server or Three tier.""" SINGLE_SERVER = "SingleServer" + """SAP Single server deployment type.""" THREE_TIER = "ThreeTier" + """SAP Distributed deployment type.""" class SAPEnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the environment type - Production/Non Production.""" NON_PROD = "NonProd" + """Non Production SAP system.""" PROD = "Prod" + """Production SAP system.""" class SAPHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the health of SAP Instances.""" UNKNOWN = "Unknown" + """SAP System health is unknown.""" HEALTHY = "Healthy" + """SAP System health is healthy.""" UNHEALTHY = "Unhealthy" + """SAP System is unhealthy.""" DEGRADED = "Degraded" + """SAP System health is degraded.""" class SAPHighAvailabilityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The high availability type (AvailabilitySet or AvailabilityZone).""" AVAILABILITY_SET = "AvailabilitySet" + """HA deployment with availability sets.""" AVAILABILITY_ZONE = "AvailabilityZone" + """HA deployment with availability zones.""" class SAPProductType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the SAP Product type.""" ECC = "ECC" - S4_HANA = "S4HANA" + """SAP Product ECC.""" + S4HANA = "S4HANA" + """SAP Product S4HANA.""" OTHER = "Other" + """SAP Products other than the ones listed.""" class SAPSoftwareInstallationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The SAP software installation Type.""" SERVICE_INITIATED = "ServiceInitiated" + """SAP Install managed by service.""" SAP_INSTALL_WITHOUT_OS_CONFIG = "SAPInstallWithoutOSConfig" + """SAP Install without OS Config.""" EXTERNAL = "External" + """External software installation type.""" + + +class SAPVirtualInstanceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where only None and UserAssigned types are allowed).""" + + NONE = "None" + """No managed identity.""" + USER_ASSIGNED = "UserAssigned" + """User assigned managed identity.""" class SapVirtualInstanceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the provisioning states.""" SUCCEEDED = "Succeeded" + """ACSS succeeded provisioning state.""" UPDATING = "Updating" + """ACSS updating provisioning state.""" CREATING = "Creating" + """ACSS Creating provisioning state.""" FAILED = "Failed" + """ACSS Failed provisioning state.""" DELETING = "Deleting" + """ACSS Deleting provisioning state.""" CANCELED = "Canceled" + """ACSS Canceled provisioning state.""" class SAPVirtualInstanceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the Virtual Instance for SAP state.""" INFRASTRUCTURE_DEPLOYMENT_PENDING = "InfrastructureDeploymentPending" + """Infrastructure is not yet deployed.""" INFRASTRUCTURE_DEPLOYMENT_IN_PROGRESS = "InfrastructureDeploymentInProgress" + """Infrastructure deployment is in progress.""" INFRASTRUCTURE_DEPLOYMENT_FAILED = "InfrastructureDeploymentFailed" + """Infrastructure deployment has failed.""" SOFTWARE_INSTALLATION_PENDING = "SoftwareInstallationPending" + """Infrastructure deployment is successful. Software installation is pending.""" SOFTWARE_INSTALLATION_IN_PROGRESS = "SoftwareInstallationInProgress" + """Software installation is in progress.""" SOFTWARE_INSTALLATION_FAILED = "SoftwareInstallationFailed" + """Software installation failed.""" SOFTWARE_DETECTION_IN_PROGRESS = "SoftwareDetectionInProgress" + """Software detection is in progress.""" SOFTWARE_DETECTION_FAILED = "SoftwareDetectionFailed" + """Software detection failed.""" DISCOVERY_PENDING = "DiscoveryPending" + """Registration has not started.""" DISCOVERY_IN_PROGRESS = "DiscoveryInProgress" + """Registration is in progress.""" DISCOVERY_FAILED = "DiscoveryFailed" + """Registration has failed.""" REGISTRATION_COMPLETE = "RegistrationComplete" + """Registration is complete.""" ACSS_INSTALLATION_BLOCKED = "ACSSInstallationBlocked" + """ACSS installation cannot proceed.""" class SAPVirtualInstanceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the SAP Instance status.""" STARTING = "Starting" + """SAP system is getting started.""" RUNNING = "Running" + """SAP system is running.""" STOPPING = "Stopping" + """SAP system is being stopped.""" OFFLINE = "Offline" + """SAP system is offline.""" PARTIALLY_RUNNING = "PartiallyRunning" + """SAP system is partially running.""" UNAVAILABLE = "Unavailable" + """SAP system status is unavailable.""" SOFT_SHUTDOWN = "SoftShutdown" + """Soft shutdown of SAP system is initiated.""" diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/_models.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/_models.py new file mode 100644 index 0000000000000..9a87c9c337069 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/_models.py @@ -0,0 +1,4288 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Dict, List, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .. import _model_base +from .._model_base import rest_discriminator, rest_field +from ._enums import ( + FileShareConfigurationType, + NamingPatternType, + OSType, + SAPConfigurationType, + SAPDeploymentType, + SAPSoftwareInstallationType, +) + +if TYPE_CHECKING: + from .. import models as _models + + +class ApplicationServerConfiguration(_model_base.Model): + """Gets or sets the application server configuration. + + + :ivar subnet_id: The subnet id. Required. + :vartype subnet_id: str + :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. + :vartype virtual_machine_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineConfiguration + :ivar instance_count: The number of app server instances. Required. + :vartype instance_count: int + """ + + subnet_id: str = rest_field(name="subnetId") + """The subnet id. Required.""" + virtual_machine_configuration: "_models.VirtualMachineConfiguration" = rest_field( + name="virtualMachineConfiguration" + ) + """Gets or sets the virtual machine configuration. Required.""" + instance_count: int = rest_field(name="instanceCount") + """The number of app server instances. Required.""" + + @overload + def __init__( + self, + *, + subnet_id: str, + virtual_machine_configuration: "_models.VirtualMachineConfiguration", + instance_count: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationServerFullResourceNames(_model_base.Model): + """The full resource names object for application layer resources. The number of entries in this + list should be equal to the number VMs to be created for application layer. + + :ivar virtual_machines: The list of virtual machine naming details. + :vartype virtual_machines: + list[~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineResourceNames] + :ivar availability_set_name: The full name for availability set. In case name is not provided, + it will be defaulted to {SID}-App-AvSet. + :vartype availability_set_name: str + """ + + virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = rest_field(name="virtualMachines") + """The list of virtual machine naming details.""" + availability_set_name: Optional[str] = rest_field(name="availabilitySetName") + """The full name for availability set. In case name is not provided, it will be defaulted to + {SID}-App-AvSet.""" + + @overload + def __init__( + self, + *, + virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = None, + availability_set_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationServerVmDetails(_model_base.Model): + """The Application Server VM Details. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: Defines the type of application server VM. Known values are: "Active", "Standby", + and "Unknown". + :vartype type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.ApplicationServerVirtualMachineType + :ivar virtual_machine_id: The virtual machine id. + :vartype virtual_machine_id: str + :ivar storage_details: Storage details of all the Storage Accounts attached to the App Virtual + Machine. For e.g. NFS on AFS Shared Storage. + :vartype storage_details: + list[~azure.mgmt.workloadssapvirtualinstance.models.StorageInformation] + """ + + type: Optional[Union[str, "_models.ApplicationServerVirtualMachineType"]] = rest_field(visibility=["read"]) + """Defines the type of application server VM. Known values are: \"Active\", \"Standby\", and + \"Unknown\".""" + virtual_machine_id: Optional[str] = rest_field(name="virtualMachineId", visibility=["read"]) + """The virtual machine id.""" + storage_details: Optional[List["_models.StorageInformation"]] = rest_field( + name="storageDetails", visibility=["read"] + ) + """Storage details of all the Storage Accounts attached to the App Virtual Machine. For e.g. NFS + on AFS Shared Storage.""" + + +class CentralServerConfiguration(_model_base.Model): + """Gets or sets the central server configuration. + + + :ivar subnet_id: The subnet id. Required. + :vartype subnet_id: str + :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. + :vartype virtual_machine_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineConfiguration + :ivar instance_count: The number of central server VMs. Required. + :vartype instance_count: int + """ + + subnet_id: str = rest_field(name="subnetId") + """The subnet id. Required.""" + virtual_machine_configuration: "_models.VirtualMachineConfiguration" = rest_field( + name="virtualMachineConfiguration" + ) + """Gets or sets the virtual machine configuration. Required.""" + instance_count: int = rest_field(name="instanceCount") + """The number of central server VMs. Required.""" + + @overload + def __init__( + self, + *, + subnet_id: str, + virtual_machine_configuration: "_models.VirtualMachineConfiguration", + instance_count: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CentralServerFullResourceNames(_model_base.Model): + """The full resource names object for central server layer resources. + + :ivar virtual_machines: The list of names for all ASCS virtual machines to be deployed. The + number of entries in this list should be equal to the number VMs to be created for ASCS layer. + At maximum, there can be two virtual machines at this layer: ASCS and ERS. + :vartype virtual_machines: + list[~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineResourceNames] + :ivar availability_set_name: The full name for availability set. In case name is not provided, + it will be defaulted to {SID}-ASCS-AvSet. + :vartype availability_set_name: str + :ivar load_balancer: The resource names object for load balancer and related resources. + :vartype load_balancer: + ~azure.mgmt.workloadssapvirtualinstance.models.LoadBalancerResourceNames + """ + + virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = rest_field(name="virtualMachines") + """The list of names for all ASCS virtual machines to be deployed. The number of entries in this + list should be equal to the number VMs to be created for ASCS layer. At maximum, there can be + two virtual machines at this layer: ASCS and ERS.""" + availability_set_name: Optional[str] = rest_field(name="availabilitySetName") + """The full name for availability set. In case name is not provided, it will be defaulted to + {SID}-ASCS-AvSet.""" + load_balancer: Optional["_models.LoadBalancerResourceNames"] = rest_field(name="loadBalancer") + """The resource names object for load balancer and related resources.""" + + @overload + def __init__( + self, + *, + virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = None, + availability_set_name: Optional[str] = None, + load_balancer: Optional["_models.LoadBalancerResourceNames"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CentralServerVmDetails(_model_base.Model): + """The SAP Central Services Instance VM details. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: Defines the type of central server VM. Known values are: "Primary", "Secondary", + "Unknown", "ASCS", "ERSInactive", "ERS", and "Standby". + :vartype type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.CentralServerVirtualMachineType + :ivar virtual_machine_id: The virtual machine id. + :vartype virtual_machine_id: str + :ivar storage_details: Storage details of all the Storage Accounts attached to the ASCS Virtual + Machine. For e.g. NFS on AFS Shared Storage. + :vartype storage_details: + list[~azure.mgmt.workloadssapvirtualinstance.models.StorageInformation] + """ + + type: Optional[Union[str, "_models.CentralServerVirtualMachineType"]] = rest_field(visibility=["read"]) + """Defines the type of central server VM. Known values are: \"Primary\", \"Secondary\", + \"Unknown\", \"ASCS\", \"ERSInactive\", \"ERS\", and \"Standby\".""" + virtual_machine_id: Optional[str] = rest_field(name="virtualMachineId", visibility=["read"]) + """The virtual machine id.""" + storage_details: Optional[List["_models.StorageInformation"]] = rest_field( + name="storageDetails", visibility=["read"] + ) + """Storage details of all the Storage Accounts attached to the ASCS Virtual Machine. For e.g. NFS + on AFS Shared Storage.""" + + +class FileShareConfiguration(_model_base.Model): + """File Share configuration details, populated with information on storage configuration mounted + on the VIS. The createAndMount option is selected in case of missing input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CreateAndMountFileShareConfiguration, MountFileShareConfiguration, SkipFileShareConfiguration + + + :ivar configuration_type: The type of file share config, eg: Mount/CreateAndMount/Skip. + Required. Known values are: "Skip", "CreateAndMount", and "Mount". + :vartype configuration_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.FileShareConfigurationType + """ + + __mapping__: Dict[str, _model_base.Model] = {} + configuration_type: str = rest_discriminator(name="configurationType") + """The type of file share config, eg: Mount/CreateAndMount/Skip. Required. Known values are: + \"Skip\", \"CreateAndMount\", and \"Mount\".""" + + @overload + def __init__( + self, + *, + configuration_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CreateAndMountFileShareConfiguration(FileShareConfiguration, discriminator="CreateAndMount"): + """Gets or sets the file share configuration where the transport directory fileshare is created + and mounted as a part of the create infra flow. Please pre-create the resource group you intend + to place the transport directory in. The storage account and fileshare will be auto-created by + the ACSS and doesn't need to be pre-created. + + + :ivar resource_group: The name of transport file share resource group. This should be pre + created by the customer. The app rg is used in case of missing input. + :vartype resource_group: str + :ivar storage_account_name: The name of file share storage account name . A custom name is used + in case of missing input. + :vartype storage_account_name: str + :ivar configuration_type: The type of file share config. Required. Fileshare will be created + and mounted by service. + :vartype configuration_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.CREATE_AND_MOUNT + """ + + resource_group: Optional[str] = rest_field(name="resourceGroup") + """The name of transport file share resource group. This should be pre created by the customer. + The app rg is used in case of missing input.""" + storage_account_name: Optional[str] = rest_field(name="storageAccountName") + """The name of file share storage account name . A custom name is used in case of missing input.""" + configuration_type: Literal[FileShareConfigurationType.CREATE_AND_MOUNT] = rest_discriminator(name="configurationType") # type: ignore + """The type of file share config. Required. Fileshare will be created and mounted by service.""" + + @overload + def __init__( + self, + *, + resource_group: Optional[str] = None, + storage_account_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, configuration_type=FileShareConfigurationType.CREATE_AND_MOUNT, **kwargs) + + +class DatabaseConfiguration(_model_base.Model): + """Gets or sets the database configuration. + + + :ivar database_type: The database type. Known values are: "HANA" and "DB2". + :vartype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType + :ivar subnet_id: The subnet id. Required. + :vartype subnet_id: str + :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. + :vartype virtual_machine_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineConfiguration + :ivar instance_count: The number of database VMs. Required. + :vartype instance_count: int + :ivar disk_configuration: Gets or sets the disk configuration. + :vartype disk_configuration: ~azure.mgmt.workloadssapvirtualinstance.models.DiskConfiguration + """ + + database_type: Optional[Union[str, "_models.SAPDatabaseType"]] = rest_field(name="databaseType") + """The database type. Known values are: \"HANA\" and \"DB2\".""" + subnet_id: str = rest_field(name="subnetId") + """The subnet id. Required.""" + virtual_machine_configuration: "_models.VirtualMachineConfiguration" = rest_field( + name="virtualMachineConfiguration" + ) + """Gets or sets the virtual machine configuration. Required.""" + instance_count: int = rest_field(name="instanceCount") + """The number of database VMs. Required.""" + disk_configuration: Optional["_models.DiskConfiguration"] = rest_field(name="diskConfiguration") + """Gets or sets the disk configuration.""" + + @overload + def __init__( + self, + *, + subnet_id: str, + virtual_machine_configuration: "_models.VirtualMachineConfiguration", + instance_count: int, + database_type: Optional[Union[str, "_models.SAPDatabaseType"]] = None, + disk_configuration: Optional["_models.DiskConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DatabaseServerFullResourceNames(_model_base.Model): + """The full resource names object for database layer resources. The number of entries in this list + should be equal to the number VMs to be created for database layer. + + :ivar virtual_machines: The list of virtual machine naming details. + :vartype virtual_machines: + list[~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineResourceNames] + :ivar availability_set_name: The full name for availability set. In case name is not provided, + it will be defaulted to {SID}-DB-AvSet. + :vartype availability_set_name: str + :ivar load_balancer: The resource names object for load balancer and related resources. + :vartype load_balancer: + ~azure.mgmt.workloadssapvirtualinstance.models.LoadBalancerResourceNames + """ + + virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = rest_field(name="virtualMachines") + """The list of virtual machine naming details.""" + availability_set_name: Optional[str] = rest_field(name="availabilitySetName") + """The full name for availability set. In case name is not provided, it will be defaulted to + {SID}-DB-AvSet.""" + load_balancer: Optional["_models.LoadBalancerResourceNames"] = rest_field(name="loadBalancer") + """The resource names object for load balancer and related resources.""" + + @overload + def __init__( + self, + *, + virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = None, + availability_set_name: Optional[str] = None, + load_balancer: Optional["_models.LoadBalancerResourceNames"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DatabaseVmDetails(_model_base.Model): + """Database VM details. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar virtual_machine_id: The virtual machine id. + :vartype virtual_machine_id: str + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". + :vartype status: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceStatus + :ivar storage_details: Storage details of all the Storage Accounts attached to the Database + Virtual Machine. For e.g. NFS on AFS Shared Storage. + :vartype storage_details: + list[~azure.mgmt.workloadssapvirtualinstance.models.StorageInformation] + """ + + virtual_machine_id: Optional[str] = rest_field(name="virtualMachineId", visibility=["read"]) + """The virtual machine id.""" + status: Optional[Union[str, "_models.SAPVirtualInstanceStatus"]] = rest_field(visibility=["read"]) + """Defines the SAP Instance status. Known values are: \"Starting\", \"Running\", \"Stopping\", + \"Offline\", \"PartiallyRunning\", \"Unavailable\", and \"SoftShutdown\".""" + storage_details: Optional[List["_models.StorageInformation"]] = rest_field( + name="storageDetails", visibility=["read"] + ) + """Storage details of all the Storage Accounts attached to the Database Virtual Machine. For e.g. + NFS on AFS Shared Storage.""" + + +class DeployerVmPackages(_model_base.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 + """ + + url: Optional[str] = rest_field() + """The URL to the deployer VM packages file.""" + storage_account_id: Optional[str] = rest_field(name="storageAccountId") + """The deployer VM packages storage account id.""" + + @overload + def __init__( + self, + *, + url: Optional[str] = None, + storage_account_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPConfiguration(_model_base.Model): + """The SAP Configuration. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DeploymentConfiguration, DeploymentWithOSConfiguration, DiscoveryConfiguration + + + :ivar configuration_type: The configuration type. Eg: Deployment/Discovery. Required. Known + values are: "Deployment", "Discovery", and "DeploymentWithOSConfig". + :vartype configuration_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAPConfigurationType + """ + + __mapping__: Dict[str, _model_base.Model] = {} + configuration_type: str = rest_discriminator(name="configurationType") + """The configuration type. Eg: Deployment/Discovery. Required. Known values are: \"Deployment\", + \"Discovery\", and \"DeploymentWithOSConfig\".""" + + @overload + def __init__( + self, + *, + configuration_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeploymentConfiguration(SAPConfiguration, discriminator="Deployment"): + """Deployment Configuration. + + + :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.workloadssapvirtualinstance.models.InfrastructureConfiguration + :ivar software_configuration: The software configuration. + :vartype software_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.SoftwareConfiguration + :ivar configuration_type: The deployment configuration Type. Required. SAP system will be + deployed by service. No OS configurations will be done. + :vartype configuration_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.DEPLOYMENT + """ + + app_location: Optional[str] = rest_field(name="appLocation") + """The geo-location where the SAP system is to be created.""" + infrastructure_configuration: Optional["_models.InfrastructureConfiguration"] = rest_field( + name="infrastructureConfiguration" + ) + """The infrastructure configuration.""" + software_configuration: Optional["_models.SoftwareConfiguration"] = rest_field(name="softwareConfiguration") + """The software configuration.""" + configuration_type: Literal[SAPConfigurationType.DEPLOYMENT] = rest_discriminator(name="configurationType") # type: ignore # pylint: disable=line-too-long + """The deployment configuration Type. Required. SAP system will be deployed by service. No OS + configurations will be done.""" + + @overload + def __init__( + self, + *, + app_location: Optional[str] = None, + infrastructure_configuration: Optional["_models.InfrastructureConfiguration"] = None, + software_configuration: Optional["_models.SoftwareConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, configuration_type=SAPConfigurationType.DEPLOYMENT, **kwargs) + + +class DeploymentWithOSConfiguration(SAPConfiguration, discriminator="DeploymentWithOSConfig"): + """Deployment along with OS Configuration. + + + :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.workloadssapvirtualinstance.models.InfrastructureConfiguration + :ivar software_configuration: The software configuration. + :vartype software_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.SoftwareConfiguration + :ivar os_sap_configuration: The OS and SAP configuration. + :vartype os_sap_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.OsSapConfiguration + :ivar configuration_type: The configuration Type. Required. SAP system will be deployed by + service. OS configurations will be done. + :vartype configuration_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.DEPLOYMENT_WITH_OS_CONFIG + """ + + app_location: Optional[str] = rest_field(name="appLocation") + """The geo-location where the SAP system is to be created.""" + infrastructure_configuration: Optional["_models.InfrastructureConfiguration"] = rest_field( + name="infrastructureConfiguration" + ) + """The infrastructure configuration.""" + software_configuration: Optional["_models.SoftwareConfiguration"] = rest_field(name="softwareConfiguration") + """The software configuration.""" + os_sap_configuration: Optional["_models.OsSapConfiguration"] = rest_field(name="osSapConfiguration") + """The OS and SAP configuration.""" + configuration_type: Literal[SAPConfigurationType.DEPLOYMENT_WITH_OS_CONFIG] = rest_discriminator(name="configurationType") # type: ignore + """The configuration Type. Required. SAP system will be deployed by service. OS configurations + will be done.""" + + @overload + def __init__( + self, + *, + app_location: Optional[str] = None, + infrastructure_configuration: Optional["_models.InfrastructureConfiguration"] = None, + software_configuration: Optional["_models.SoftwareConfiguration"] = None, + os_sap_configuration: Optional["_models.OsSapConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, configuration_type=SAPConfigurationType.DEPLOYMENT_WITH_OS_CONFIG, **kwargs) + + +class DiscoveryConfiguration(SAPConfiguration, discriminator="Discovery"): + """Discovery Details. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + + :ivar central_server_vm_id: The virtual machine ID of the Central Server. + :vartype central_server_vm_id: str + :ivar managed_rg_storage_account_name: The custom storage account name for the storage account + created by the service in the managed resource group created as part of VIS + deployment.:code:`
`:code:`
`Refer to the storage account naming rules `here + `_.:code:`
`:code:`
`If # pylint: disable=line-too-long + not provided, the service will create the storage account with a random name. + :vartype managed_rg_storage_account_name: str + :ivar app_location: The geo-location where the SAP system exists. + :vartype app_location: str + :ivar configuration_type: The configuration Type. Required. Existing SAP system will be + registered. + :vartype configuration_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.DISCOVERY + """ + + central_server_vm_id: Optional[str] = rest_field(name="centralServerVmId") + """The virtual machine ID of the Central Server.""" + managed_rg_storage_account_name: Optional[str] = rest_field(name="managedRgStorageAccountName") + """The custom storage account name for the storage account created by the service in the managed + resource group created as part of VIS deployment.:code:`
`:code:`
`Refer to the storage + account naming rules `here + `_.:code:`
`:code:`
`If # pylint: disable=line-too-long + not provided, the service will create the storage account with a random name.""" + app_location: Optional[str] = rest_field(name="appLocation", visibility=["read"]) + """The geo-location where the SAP system exists.""" + configuration_type: Literal[SAPConfigurationType.DISCOVERY] = rest_discriminator(name="configurationType") # type: ignore # pylint: disable=line-too-long + """The configuration Type. Required. Existing SAP system will be registered.""" + + @overload + def __init__( + self, + *, + central_server_vm_id: Optional[str] = None, + managed_rg_storage_account_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, configuration_type=SAPConfigurationType.DISCOVERY, **kwargs) + + +class DiskConfiguration(_model_base.Model): + """The Disk Configuration Details. + + :ivar disk_volume_configurations: The disk configuration for the db volume. For HANA, Required + volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : + ['backup']. + :vartype disk_volume_configurations: dict[str, + ~azure.mgmt.workloadssapvirtualinstance.models.DiskVolumeConfiguration] + """ + + disk_volume_configurations: Optional[Dict[str, "_models.DiskVolumeConfiguration"]] = rest_field( + name="diskVolumeConfigurations" + ) + """The disk configuration for the db volume. For HANA, Required volumes are: ['hana/data', + 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : ['backup'].""" + + @overload + def __init__( + self, + *, + disk_volume_configurations: Optional[Dict[str, "_models.DiskVolumeConfiguration"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskDetails(_model_base.Model): + """The supported disk size details for a disk type. + + :ivar sku: The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, + Premium_ZRS. + :vartype sku: ~azure.mgmt.workloadssapvirtualinstance.models.DiskSku + :ivar size_gb: The disk size in GB. + :vartype size_gb: int + :ivar minimum_supported_disk_count: The minimum supported disk count. + :vartype minimum_supported_disk_count: int + :ivar maximum_supported_disk_count: The maximum supported disk count. + :vartype maximum_supported_disk_count: int + :ivar iops_read_write: The disk Iops. + :vartype iops_read_write: int + :ivar mbps_read_write: The disk provisioned throughput in MBps. + :vartype mbps_read_write: int + :ivar disk_tier: The disk tier, e.g. P10, E10. + :vartype disk_tier: str + """ + + sku: Optional["_models.DiskSku"] = rest_field() + """The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, Premium_ZRS.""" + size_gb: Optional[int] = rest_field(name="sizeGB") + """The disk size in GB.""" + minimum_supported_disk_count: Optional[int] = rest_field(name="minimumSupportedDiskCount") + """The minimum supported disk count.""" + maximum_supported_disk_count: Optional[int] = rest_field(name="maximumSupportedDiskCount") + """The maximum supported disk count.""" + iops_read_write: Optional[int] = rest_field(name="iopsReadWrite") + """The disk Iops.""" + mbps_read_write: Optional[int] = rest_field(name="mbpsReadWrite") + """The disk provisioned throughput in MBps.""" + disk_tier: Optional[str] = rest_field(name="diskTier") + """The disk tier, e.g. P10, E10.""" + + @overload + def __init__( + self, + *, + sku: Optional["_models.DiskSku"] = None, + size_gb: Optional[int] = None, + minimum_supported_disk_count: Optional[int] = None, + maximum_supported_disk_count: Optional[int] = None, + iops_read_write: Optional[int] = None, + mbps_read_write: Optional[int] = None, + disk_tier: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskSku(_model_base.Model): + """The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, Premium_ZRS. + + :ivar name: Defines the disk sku name. Known values are: "Standard_LRS", "Premium_LRS", + "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS", and "PremiumV2_LRS". + :vartype name: str or ~azure.mgmt.workloadssapvirtualinstance.models.DiskSkuName + """ + + name: Optional[Union[str, "_models.DiskSkuName"]] = rest_field() + """Defines the disk sku name. Known values are: \"Standard_LRS\", \"Premium_LRS\", + \"StandardSSD_LRS\", \"UltraSSD_LRS\", \"Premium_ZRS\", \"StandardSSD_ZRS\", and + \"PremiumV2_LRS\".""" + + @overload + def __init__( + self, + *, + name: Optional[Union[str, "_models.DiskSkuName"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DiskVolumeConfiguration(_model_base.Model): + """The disk configuration required for the selected volume. + + :ivar count: The total number of disks required for the concerned volume. + :vartype count: int + :ivar size_gb: The disk size in GB. + :vartype size_gb: int + :ivar sku: The disk SKU details. + :vartype sku: ~azure.mgmt.workloadssapvirtualinstance.models.DiskSku + """ + + count: Optional[int] = rest_field() + """The total number of disks required for the concerned volume.""" + size_gb: Optional[int] = rest_field(name="sizeGB") + """The disk size in GB.""" + sku: Optional["_models.DiskSku"] = rest_field() + """The disk SKU details.""" + + @overload + def __init__( + self, + *, + count: Optional[int] = None, + size_gb: Optional[int] = None, + sku: Optional["_models.DiskSku"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EnqueueReplicationServerProperties(_model_base.Model): + """Defines the SAP Enqueue Replication Server (ERS) properties. + + Readonly 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. Known values are: + "EnqueueReplicator1" and "EnqueueReplicator2". + :vartype ers_version: str or + ~azure.mgmt.workloadssapvirtualinstance.models.EnqueueReplicationServerType + :ivar instance_no: ERS Instance Number. + :vartype instance_no: str + :ivar hostname: ERS SAP Hostname. + :vartype hostname: str + :ivar kernel_version: ERS SAP Kernel Version. + :vartype kernel_version: str + :ivar kernel_patch: ERS SAP Kernel Patch level. + :vartype kernel_patch: str + :ivar ip_address: ERS SAP IP Address. + :vartype ip_address: str + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPHealthState + """ + + ers_version: Optional[Union[str, "_models.EnqueueReplicationServerType"]] = rest_field( + name="ersVersion", visibility=["read"] + ) + """Defines the type of Enqueue Replication Server. Known values are: \"EnqueueReplicator1\" and + \"EnqueueReplicator2\".""" + instance_no: Optional[str] = rest_field(name="instanceNo", visibility=["read"]) + """ERS Instance Number.""" + hostname: Optional[str] = rest_field(visibility=["read"]) + """ERS SAP Hostname.""" + kernel_version: Optional[str] = rest_field(name="kernelVersion", visibility=["read"]) + """ERS SAP Kernel Version.""" + kernel_patch: Optional[str] = rest_field(name="kernelPatch", visibility=["read"]) + """ERS SAP Kernel Patch level.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read"]) + """ERS SAP IP Address.""" + health: Optional[Union[str, "_models.SAPHealthState"]] = rest_field(visibility=["read"]) + """Defines the health of SAP Instances. Known values are: \"Unknown\", \"Healthy\", \"Unhealthy\", + and \"Degraded\".""" + + +class EnqueueServerProperties(_model_base.Model): + """Defines the SAP Enqueue Server properties. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar hostname: Enqueue Server SAP Hostname. + :vartype hostname: str + :ivar ip_address: Enqueue Server SAP IP Address. + :vartype ip_address: str + :ivar port: Enqueue Server Port. + :vartype port: int + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPHealthState + """ + + hostname: Optional[str] = rest_field(visibility=["read"]) + """Enqueue Server SAP Hostname.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read"]) + """Enqueue Server SAP IP Address.""" + port: Optional[int] = rest_field(visibility=["read"]) + """Enqueue Server Port.""" + health: Optional[Union[str, "_models.SAPHealthState"]] = rest_field(visibility=["read"]) + """Defines the health of SAP Instances. Known values are: \"Unknown\", \"Healthy\", \"Unhealthy\", + and \"Degraded\".""" + + +class ErrorAdditionalInfo(_model_base.Model): + """The resource management error additional info. + + Readonly 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 + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDefinition(_model_base.Model): + """Error definition. + + Readonly 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.workloadssapvirtualinstance.models.ErrorDefinition] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """Service specific error code which serves as the substatus for the HTTP error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """Description of the error.""" + details: Optional[List["_models.ErrorDefinition"]] = rest_field(visibility=["read"]) + """Internal error details.""" + + +class ErrorDetail(_model_base.Model): + """The error detail. + + Readonly 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.workloadssapvirtualinstance.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.workloadssapvirtualinstance.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[List["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_model_base.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.workloadssapvirtualinstance.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field() + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SoftwareConfiguration(_model_base.Model): + """The SAP Software configuration Input. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExternalInstallationSoftwareConfiguration, SAPInstallWithoutOSConfigSoftwareConfiguration, + ServiceInitiatedSoftwareConfiguration + + + :ivar software_installation_type: The SAP software installation type. Required. Known values + are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External". + :vartype software_installation_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAPSoftwareInstallationType + """ + + __mapping__: Dict[str, _model_base.Model] = {} + software_installation_type: str = rest_discriminator(name="softwareInstallationType") + """The SAP software installation type. Required. Known values are: \"ServiceInitiated\", + \"SAPInstallWithoutOSConfig\", and \"External\".""" + + @overload + def __init__( + self, + *, + software_installation_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExternalInstallationSoftwareConfiguration( + SoftwareConfiguration, discriminator="External" +): # pylint: disable=name-too-long + """The SAP Software configuration Input when the software is installed externally outside the + service. + + + :ivar central_server_vm_id: The resource ID of the virtual machine containing the central + server instance. + :vartype central_server_vm_id: str + :ivar software_installation_type: The SAP software installation Type. Required. External + software installation type. + :vartype software_installation_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.EXTERNAL + """ + + central_server_vm_id: Optional[str] = rest_field(name="centralServerVmId") + """The resource ID of the virtual machine containing the central server instance.""" + software_installation_type: Literal[SAPSoftwareInstallationType.EXTERNAL] = rest_discriminator(name="softwareInstallationType") # type: ignore + """The SAP software installation Type. Required. External software installation type.""" + + @overload + def __init__( + self, + *, + central_server_vm_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, software_installation_type=SAPSoftwareInstallationType.EXTERNAL, **kwargs) + + +class GatewayServerProperties(_model_base.Model): + """Defines the SAP Gateway Server properties. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar port: Gateway Port. + :vartype port: int + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPHealthState + """ + + port: Optional[int] = rest_field(visibility=["read"]) + """Gateway Port.""" + health: Optional[Union[str, "_models.SAPHealthState"]] = rest_field(visibility=["read"]) + """Defines the health of SAP Instances. Known values are: \"Unknown\", \"Healthy\", \"Unhealthy\", + and \"Degraded\".""" + + +class HighAvailabilityConfiguration(_model_base.Model): + """Gets or sets the high availability configuration. + + + :ivar high_availability_type: The high availability type. Required. Known values are: + "AvailabilitySet" and "AvailabilityZone". + :vartype high_availability_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAPHighAvailabilityType + """ + + high_availability_type: Union[str, "_models.SAPHighAvailabilityType"] = rest_field(name="highAvailabilityType") + """The high availability type. Required. Known values are: \"AvailabilitySet\" and + \"AvailabilityZone\".""" + + @overload + def __init__( + self, + *, + high_availability_type: Union[str, "_models.SAPHighAvailabilityType"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HighAvailabilitySoftwareConfiguration(_model_base.Model): + """Gets or sets the HA software configuration. + + + :ivar fencing_client_id: The fencing client id. Required. + :vartype fencing_client_id: str + :ivar fencing_client_password: The fencing client id secret/password. The secret should never + expire. This will be used pacemaker to start/stop the cluster VMs. Required. + :vartype fencing_client_password: str + """ + + fencing_client_id: str = rest_field(name="fencingClientId") + """The fencing client id. Required.""" + fencing_client_password: str = rest_field(name="fencingClientPassword") + """The fencing client id secret/password. The secret should never expire. This will be used + pacemaker to start/stop the cluster VMs. Required.""" + + @overload + def __init__( + self, + *, + fencing_client_id: str, + fencing_client_password: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImageReference(_model_base.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. + + :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 id: Specifies the ARM resource ID of the Azure Compute Gallery image version used for + creating ACSS VMs. You will need to provide this input when you choose to deploy virtual + machines in ACSS with OS image from the Azure Compute gallery. + :vartype id: str + """ + + publisher: Optional[str] = rest_field() + """The image publisher.""" + offer: Optional[str] = rest_field() + """Specifies the offer of the platform image or marketplace image used to create the virtual + machine.""" + sku: Optional[str] = rest_field() + """The image SKU.""" + version: Optional[str] = rest_field() + """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.""" + id: Optional[str] = rest_field() + """Specifies the ARM resource ID of the Azure Compute Gallery image version used for creating ACSS + VMs. You will need to provide this input when you choose to deploy virtual machines in ACSS + with OS image from the Azure Compute gallery.""" + + @overload + def __init__( + self, + *, + publisher: Optional[str] = None, + offer: Optional[str] = None, + sku: Optional[str] = None, + version: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InfrastructureConfiguration(_model_base.Model): + """Deploy SAP Infrastructure Details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SingleServerConfiguration, ThreeTierConfiguration + + + :ivar app_resource_group: The application resource group where SAP system resources will be + deployed. Required. + :vartype app_resource_group: str + :ivar deployment_type: The SAP deployment type. Eg: SingleServer/ThreeTier. Required. Known + values are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType + """ + + __mapping__: Dict[str, _model_base.Model] = {} + app_resource_group: str = rest_field(name="appResourceGroup") + """The application resource group where SAP system resources will be deployed. Required.""" + deployment_type: str = rest_discriminator(name="deploymentType") + """The SAP deployment type. Eg: SingleServer/ThreeTier. Required. Known values are: + \"SingleServer\" and \"ThreeTier\".""" + + @overload + def __init__( + self, + *, + app_resource_group: str, + deployment_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OSConfiguration(_model_base.Model): + """Defines the OS configuration. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + LinuxConfiguration, WindowsConfiguration + + + :ivar os_type: The OS Type. Required. Known values are: "Linux" and "Windows". + :vartype os_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.OSType + """ + + __mapping__: Dict[str, _model_base.Model] = {} + os_type: str = rest_discriminator(name="osType") + """The OS Type. Required. Known values are: \"Linux\" and \"Windows\".""" + + @overload + def __init__( + self, + *, + os_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LinuxConfiguration(OSConfiguration, discriminator="Linux"): + """Specifies the Linux operating system settings on the virtual machine. For a list of supported + Linux distributions, see `Linux on Azure-Endorsed Distributions + `_. + + + :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.workloadssapvirtualinstance.models.SshConfiguration + :ivar ssh_key_pair: The SSH Key-pair used to authenticate with the VM's. + :vartype ssh_key_pair: ~azure.mgmt.workloadssapvirtualinstance.models.SshKeyPair + :ivar os_type: The OS Type. Required. Linux OS Type. + :vartype os_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.LINUX + """ + + disable_password_authentication: Optional[bool] = rest_field(name="disablePasswordAuthentication") + """Specifies whether password authentication should be disabled.""" + ssh: Optional["_models.SshConfiguration"] = rest_field() + """Specifies the ssh key configuration for a Linux OS. (This property is deprecated, please use + 'sshKeyPair' instead).""" + ssh_key_pair: Optional["_models.SshKeyPair"] = rest_field(name="sshKeyPair") + """The SSH Key-pair used to authenticate with the VM's.""" + os_type: Literal[OSType.LINUX] = rest_discriminator(name="osType") # type: ignore + """The OS Type. Required. Linux OS Type.""" + + @overload + def __init__( + self, + *, + disable_password_authentication: Optional[bool] = None, + ssh: Optional["_models.SshConfiguration"] = None, + ssh_key_pair: Optional["_models.SshKeyPair"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, os_type=OSType.LINUX, **kwargs) + + +class LoadBalancerDetails(_model_base.Model): + """The Load Balancer details such as Load Balancer ID. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the load balancer. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the load balancer.""" + + +class LoadBalancerResourceNames(_model_base.Model): + """The resource names object for load balancer and related resources. + + :ivar load_balancer_name: The full resource name for load balancer. If this value is not + provided, load balancer will be name as {ASCS/DB}-loadBalancer. + :vartype load_balancer_name: str + :ivar frontend_ip_configuration_names: The list of frontend IP configuration names. If provided + as input, size of this list should be 2 for cs layer and should be 1 for database layer. + :vartype frontend_ip_configuration_names: list[str] + :ivar backend_pool_names: The list of backend pool names. Currently, ACSS deploys only one + backend pool and hence, size of this list should be 1. + :vartype backend_pool_names: list[str] + :ivar health_probe_names: The list of health probe names. If provided as input, size of this + list should be 2 for cs layer and should be 1 for database layer. + :vartype health_probe_names: list[str] + """ + + load_balancer_name: Optional[str] = rest_field(name="loadBalancerName") + """The full resource name for load balancer. If this value is not provided, load balancer will be + name as {ASCS/DB}-loadBalancer.""" + frontend_ip_configuration_names: Optional[List[str]] = rest_field(name="frontendIpConfigurationNames") + """The list of frontend IP configuration names. If provided as input, size of this list should be + 2 for cs layer and should be 1 for database layer.""" + backend_pool_names: Optional[List[str]] = rest_field(name="backendPoolNames") + """The list of backend pool names. Currently, ACSS deploys only one backend pool and hence, size + of this list should be 1.""" + health_probe_names: Optional[List[str]] = rest_field(name="healthProbeNames") + """The list of health probe names. If provided as input, size of this list should be 2 for cs + layer and should be 1 for database layer.""" + + @overload + def __init__( + self, + *, + load_balancer_name: Optional[str] = None, + frontend_ip_configuration_names: Optional[List[str]] = None, + backend_pool_names: Optional[List[str]] = None, + health_probe_names: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedRGConfiguration(_model_base.Model): + """Managed resource group configuration. + + :ivar name: Managed resource group name. + :vartype name: str + """ + + name: Optional[str] = rest_field() + """Managed resource group name.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MessageServerProperties(_model_base.Model): + """Defines the SAP message server properties. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar ms_port: message server port. + :vartype ms_port: int + :ivar internal_ms_port: message server internal MS port. + :vartype internal_ms_port: int + :ivar http_port: message server HTTP Port. + :vartype http_port: int + :ivar https_port: message server HTTPS Port. + :vartype https_port: int + :ivar hostname: message server SAP Hostname. + :vartype hostname: str + :ivar ip_address: message server IP Address. + :vartype ip_address: str + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPHealthState + """ + + ms_port: Optional[int] = rest_field(name="msPort", visibility=["read"]) + """message server port.""" + internal_ms_port: Optional[int] = rest_field(name="internalMsPort", visibility=["read"]) + """message server internal MS port.""" + http_port: Optional[int] = rest_field(name="httpPort", visibility=["read"]) + """message server HTTP Port.""" + https_port: Optional[int] = rest_field(name="httpsPort", visibility=["read"]) + """message server HTTPS Port.""" + hostname: Optional[str] = rest_field(visibility=["read"]) + """message server SAP Hostname.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read"]) + """message server IP Address.""" + health: Optional[Union[str, "_models.SAPHealthState"]] = rest_field(visibility=["read"]) + """Defines the health of SAP Instances. Known values are: \"Unknown\", \"Healthy\", \"Unhealthy\", + and \"Degraded\".""" + + +class MountFileShareConfiguration(FileShareConfiguration, discriminator="Mount"): + """Gets or sets the file share configuration where the transport directory fileshare already + exists, and user wishes to mount the fileshare as a part of the create infra flow. + + + :ivar id: The fileshare resource ID. Required. + :vartype id: str + :ivar private_endpoint_id: The private endpoint resource ID. Required. + :vartype private_endpoint_id: str + :ivar configuration_type: The type of file share config, mount in this case. Required. Existing + fileshare provided will be mounted by service. + :vartype configuration_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.MOUNT + """ + + id: str = rest_field() + """The fileshare resource ID. Required.""" + private_endpoint_id: str = rest_field(name="privateEndpointId") + """The private endpoint resource ID. Required.""" + configuration_type: Literal[FileShareConfigurationType.MOUNT] = rest_discriminator(name="configurationType") # type: ignore # pylint: disable=line-too-long + """The type of file share config, mount in this case. Required. Existing fileshare provided will + be mounted by service.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + private_endpoint_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, configuration_type=FileShareConfigurationType.MOUNT, **kwargs) + + +class NetworkConfiguration(_model_base.Model): + """Defines the network configuration type for SAP system infrastructure that is being deployed. + + :ivar is_secondary_ip_enabled: Specifies whether a secondary IP address should be added to the + network interface on all VMs of the SAP system being deployed. + :vartype is_secondary_ip_enabled: bool + """ + + is_secondary_ip_enabled: Optional[bool] = rest_field(name="isSecondaryIpEnabled") + """Specifies whether a secondary IP address should be added to the network interface on all VMs of + the SAP system being deployed.""" + + @overload + def __init__( + self, + *, + is_secondary_ip_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkInterfaceResourceNames(_model_base.Model): + """The resource names object for network interface and related resources. + + :ivar network_interface_name: The full name for network interface. If name is not provided, + service uses a default name based on the deployment type. For SingleServer, default name is + {SID}-Nic. In case of HA-AvZone systems, default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic + with an incrementor at the end in case of more than 1 instance per layer. For distributed and + HA-AvSet systems, default name will be {SID}-{App/ASCS/DB}-Nic with an incrementor at the end + in case of more than 1 instance per layer. + :vartype network_interface_name: str + """ + + network_interface_name: Optional[str] = rest_field(name="networkInterfaceName") + """The full name for network interface. If name is not provided, service uses a default name based + on the deployment type. For SingleServer, default name is {SID}-Nic. In case of HA-AvZone + systems, default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic with an incrementor at the end + in case of more than 1 instance per layer. For distributed and HA-AvSet systems, default name + will be {SID}-{App/ASCS/DB}-Nic with an incrementor at the end in case of more than 1 instance + per layer.""" + + @overload + def __init__( + self, + *, + network_interface_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Operation(_model_base.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Readonly 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 Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.workloadssapvirtualinstance.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". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.workloadssapvirtualinstance.models.Origin + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.ActionType + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field() + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + @overload + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDisplay(_model_base.Model): + """Localized display information for and operation. + + Readonly 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 + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class OperationStatusResult(_model_base.Model): + """The current status of an async operation. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Required. + :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.workloadssapvirtualinstance.models.OperationStatusResult] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.workloadssapvirtualinstance.models.ErrorDetail + :ivar resource_id: Fully qualified ID of the resource against which the original async + operation was started. + :vartype resource_id: str + """ + + id: Optional[str] = rest_field() + """Fully qualified ID for the async operation.""" + name: Optional[str] = rest_field() + """Name of the async operation.""" + status: str = rest_field() + """Operation status. Required.""" + percent_complete: Optional[float] = rest_field(name="percentComplete") + """Percent of the operation that is complete.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", format="rfc3339") + """The start time of the operation.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", format="rfc3339") + """The end time of the operation.""" + operations: Optional[List["_models.OperationStatusResult"]] = rest_field() + """The operations list.""" + error: Optional["_models.ErrorDetail"] = rest_field() + """If present, details of the operation error.""" + resource_id: Optional[str] = rest_field(name="resourceId", visibility=["read"]) + """Fully qualified ID of the resource against which the original async operation was started.""" + + @overload + def __init__( + self, + *, + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["_models.OperationStatusResult"]] = None, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OSProfile(_model_base.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.workloadssapvirtualinstance.models.OSConfiguration + """ + + admin_username: Optional[str] = rest_field(name="adminUsername") + """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.""" + admin_password: Optional[str] = rest_field(name="adminPassword") + """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 + `_.""" + os_configuration: Optional["_models.OSConfiguration"] = rest_field(name="osConfiguration") + """Specifies Windows operating system settings on the virtual machine.""" + + @overload + def __init__( + self, + *, + admin_username: Optional[str] = None, + admin_password: Optional[str] = None, + os_configuration: Optional["_models.OSConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OsSapConfiguration(_model_base.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.workloadssapvirtualinstance.models.DeployerVmPackages + :ivar sap_fqdn: The FQDN to set for the SAP system. + :vartype sap_fqdn: str + """ + + deployer_vm_packages: Optional["_models.DeployerVmPackages"] = rest_field(name="deployerVmPackages") + """The url and storage account ID where deployer VM packages are uploaded.""" + sap_fqdn: Optional[str] = rest_field(name="sapFqdn") + """The FQDN to set for the SAP system.""" + + @overload + def __init__( + self, + *, + deployer_vm_packages: Optional["_models.DeployerVmPackages"] = None, + sap_fqdn: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resource(_model_base.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Readonly 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}. # pylint: disable=line-too-long + :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.workloadssapvirtualinstance.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Readonly 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}. # pylint: disable=line-too-long + :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.workloadssapvirtualinstance.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[Dict[str, str]] = rest_field() + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPApplicationServerInstance(TrackedResource): + """Define the SAP Application Server Instance resource. + + Readonly 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}. # pylint: disable=line-too-long + :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.workloadssapvirtualinstance.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerProperties + """ + + properties: Optional["_models.SAPApplicationServerProperties"] = rest_field() + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.SAPApplicationServerProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPApplicationServerProperties(_model_base.Model): + """Defines the SAP Application Server instance properties. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar instance_no: Application server Instance Number. + :vartype instance_no: str + :ivar subnet: Application server Subnet. + :vartype subnet: str + :ivar hostname: Application server instance SAP hostname. + :vartype hostname: str + :ivar kernel_version: Application server instance SAP Kernel Version. + :vartype kernel_version: str + :ivar kernel_patch: Application server instance SAP Kernel Patch level. + :vartype kernel_patch: str + :ivar ip_address: Application server instance SAP IP Address. + :vartype ip_address: str + :ivar gateway_port: Application server instance gateway Port. + :vartype gateway_port: int + :ivar icm_http_port: Application server instance ICM HTTP Port. + :vartype icm_http_port: int + :ivar icm_https_port: Application server instance ICM HTTPS Port. + :vartype icm_https_port: int + :ivar dispatcher_status: Application server instance dispatcher status. + :vartype dispatcher_status: str + :ivar load_balancer_details: The Load Balancer details such as LoadBalancer ID attached to + Application Server Virtual Machines. + :vartype load_balancer_details: + ~azure.mgmt.workloadssapvirtualinstance.models.LoadBalancerDetails + :ivar vm_details: The list of virtual machines. + :vartype vm_details: + list[~azure.mgmt.workloadssapvirtualinstance.models.ApplicationServerVmDetails] + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". + :vartype status: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceStatus + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPHealthState + :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", + "Updating", "Creating", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SapVirtualInstanceProvisioningState + :ivar errors: Defines the Application Instance errors. + :vartype errors: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceError + """ + + instance_no: Optional[str] = rest_field(name="instanceNo", visibility=["read"]) + """Application server Instance Number.""" + subnet: Optional[str] = rest_field(visibility=["read"]) + """Application server Subnet.""" + hostname: Optional[str] = rest_field(visibility=["read"]) + """Application server instance SAP hostname.""" + kernel_version: Optional[str] = rest_field(name="kernelVersion", visibility=["read"]) + """Application server instance SAP Kernel Version.""" + kernel_patch: Optional[str] = rest_field(name="kernelPatch", visibility=["read"]) + """Application server instance SAP Kernel Patch level.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read"]) + """Application server instance SAP IP Address.""" + gateway_port: Optional[int] = rest_field(name="gatewayPort", visibility=["read"]) + """Application server instance gateway Port.""" + icm_http_port: Optional[int] = rest_field(name="icmHttpPort", visibility=["read"]) + """Application server instance ICM HTTP Port.""" + icm_https_port: Optional[int] = rest_field(name="icmHttpsPort", visibility=["read"]) + """Application server instance ICM HTTPS Port.""" + dispatcher_status: Optional[str] = rest_field(name="dispatcherStatus", visibility=["read"]) + """Application server instance dispatcher status.""" + load_balancer_details: Optional["_models.LoadBalancerDetails"] = rest_field( + name="loadBalancerDetails", visibility=["read"] + ) + """The Load Balancer details such as LoadBalancer ID attached to Application Server Virtual + Machines.""" + vm_details: Optional[List["_models.ApplicationServerVmDetails"]] = rest_field(name="vmDetails", visibility=["read"]) + """The list of virtual machines.""" + status: Optional[Union[str, "_models.SAPVirtualInstanceStatus"]] = rest_field(visibility=["read"]) + """Defines the SAP Instance status. Known values are: \"Starting\", \"Running\", \"Stopping\", + \"Offline\", \"PartiallyRunning\", \"Unavailable\", and \"SoftShutdown\".""" + health: Optional[Union[str, "_models.SAPHealthState"]] = rest_field(visibility=["read"]) + """Defines the health of SAP Instances. Known values are: \"Unknown\", \"Healthy\", \"Unhealthy\", + and \"Degraded\".""" + provisioning_state: Optional[Union[str, "_models.SapVirtualInstanceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Defines the provisioning states. Known values are: \"Succeeded\", \"Updating\", \"Creating\", + \"Failed\", \"Deleting\", and \"Canceled\".""" + errors: Optional["_models.SAPVirtualInstanceError"] = rest_field(visibility=["read"]) + """Defines the Application Instance errors.""" + + +class SAPAvailabilityZoneDetailsRequest(_model_base.Model): + """The SAP request to get list of availability zones. + + All required parameters must be populated in order to send to server. + + :ivar app_location: The geo-location where the SAP resources will be created. Required. + :vartype app_location: str + :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", + and "Other". + :vartype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType + :ivar database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: "HANA" + and "DB2". + :vartype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType + """ + + app_location: str = rest_field(name="appLocation") + """The geo-location where the SAP resources will be created. Required.""" + sap_product: Union[str, "_models.SAPProductType"] = rest_field(name="sapProduct") + """Defines the SAP Product type. Required. Known values are: \"ECC\", \"S4HANA\", and \"Other\".""" + database_type: Union[str, "_models.SAPDatabaseType"] = rest_field(name="databaseType") + """The database type. Eg: HANA, DB2, etc. Required. Known values are: \"HANA\" and \"DB2\".""" + + @overload + def __init__( + self, + *, + app_location: str, + sap_product: Union[str, "_models.SAPProductType"], + database_type: Union[str, "_models.SAPDatabaseType"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPAvailabilityZoneDetailsResult(_model_base.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.workloadssapvirtualinstance.models.SAPAvailabilityZonePair] + """ + + availability_zone_pairs: Optional[List["_models.SAPAvailabilityZonePair"]] = rest_field( + name="availabilityZonePairs" + ) + """Gets the list of availability zone pairs.""" + + @overload + def __init__( + self, + *, + availability_zone_pairs: Optional[List["_models.SAPAvailabilityZonePair"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPAvailabilityZonePair(_model_base.Model): + """The SAP Availability Zone Pair. + + :ivar zone_a: The zone A. + :vartype zone_a: int + :ivar zone_b: The zone B. + :vartype zone_b: int + """ + + zone_a: Optional[int] = rest_field(name="zoneA") + """The zone A.""" + zone_b: Optional[int] = rest_field(name="zoneB") + """The zone B.""" + + @overload + def __init__( + self, + *, + zone_a: Optional[int] = None, + zone_b: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPCentralServerInstance(TrackedResource): + """Define the SAP Central Services Instance resource. + + Readonly 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}. # pylint: disable=line-too-long + :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.workloadssapvirtualinstance.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerProperties + """ + + properties: Optional["_models.SAPCentralServerProperties"] = rest_field() + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.SAPCentralServerProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPCentralServerProperties(_model_base.Model): + """Defines the SAP Central Services Instance properties. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar instance_no: The central services instance number. + :vartype instance_no: str + :ivar subnet: The central services instance subnet. + :vartype subnet: str + :ivar message_server_properties: Defines the SAP message server properties. + :vartype message_server_properties: + ~azure.mgmt.workloadssapvirtualinstance.models.MessageServerProperties + :ivar enqueue_server_properties: Defines the SAP Enqueue Server properties. + :vartype enqueue_server_properties: + ~azure.mgmt.workloadssapvirtualinstance.models.EnqueueServerProperties + :ivar gateway_server_properties: Defines the SAP Gateway Server properties. + :vartype gateway_server_properties: + ~azure.mgmt.workloadssapvirtualinstance.models.GatewayServerProperties + :ivar enqueue_replication_server_properties: Defines the SAP Enqueue Replication Server (ERS) + properties. + :vartype enqueue_replication_server_properties: + ~azure.mgmt.workloadssapvirtualinstance.models.EnqueueReplicationServerProperties + :ivar kernel_version: The central services instance Kernel Version. + :vartype kernel_version: str + :ivar kernel_patch: The central services instance Kernel Patch level. + :vartype kernel_patch: str + :ivar load_balancer_details: The Load Balancer details such as LoadBalancer ID attached to ASCS + Virtual Machines. + :vartype load_balancer_details: + ~azure.mgmt.workloadssapvirtualinstance.models.LoadBalancerDetails + :ivar vm_details: The list of virtual machines corresponding to the Central Services instance. + :vartype vm_details: + list[~azure.mgmt.workloadssapvirtualinstance.models.CentralServerVmDetails] + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". + :vartype status: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceStatus + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPHealthState + :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", + "Updating", "Creating", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SapVirtualInstanceProvisioningState + :ivar errors: Defines the errors related to SAP Central Services Instance resource. + :vartype errors: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceError + """ + + instance_no: Optional[str] = rest_field(name="instanceNo", visibility=["read"]) + """The central services instance number.""" + subnet: Optional[str] = rest_field(visibility=["read"]) + """The central services instance subnet.""" + message_server_properties: Optional["_models.MessageServerProperties"] = rest_field(name="messageServerProperties") + """Defines the SAP message server properties.""" + enqueue_server_properties: Optional["_models.EnqueueServerProperties"] = rest_field(name="enqueueServerProperties") + """Defines the SAP Enqueue Server properties.""" + gateway_server_properties: Optional["_models.GatewayServerProperties"] = rest_field(name="gatewayServerProperties") + """Defines the SAP Gateway Server properties.""" + enqueue_replication_server_properties: Optional["_models.EnqueueReplicationServerProperties"] = rest_field( + name="enqueueReplicationServerProperties" + ) + """Defines the SAP Enqueue Replication Server (ERS) properties.""" + kernel_version: Optional[str] = rest_field(name="kernelVersion", visibility=["read"]) + """The central services instance Kernel Version.""" + kernel_patch: Optional[str] = rest_field(name="kernelPatch", visibility=["read"]) + """The central services instance Kernel Patch level.""" + load_balancer_details: Optional["_models.LoadBalancerDetails"] = rest_field( + name="loadBalancerDetails", visibility=["read"] + ) + """The Load Balancer details such as LoadBalancer ID attached to ASCS Virtual Machines.""" + vm_details: Optional[List["_models.CentralServerVmDetails"]] = rest_field(name="vmDetails", visibility=["read"]) + """The list of virtual machines corresponding to the Central Services instance.""" + status: Optional[Union[str, "_models.SAPVirtualInstanceStatus"]] = rest_field(visibility=["read"]) + """Defines the SAP Instance status. Known values are: \"Starting\", \"Running\", \"Stopping\", + \"Offline\", \"PartiallyRunning\", \"Unavailable\", and \"SoftShutdown\".""" + health: Optional[Union[str, "_models.SAPHealthState"]] = rest_field(visibility=["read"]) + """Defines the health of SAP Instances. Known values are: \"Unknown\", \"Healthy\", \"Unhealthy\", + and \"Degraded\".""" + provisioning_state: Optional[Union[str, "_models.SapVirtualInstanceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Defines the provisioning states. Known values are: \"Succeeded\", \"Updating\", \"Creating\", + \"Failed\", \"Deleting\", and \"Canceled\".""" + errors: Optional["_models.SAPVirtualInstanceError"] = rest_field(visibility=["read"]) + """Defines the errors related to SAP Central Services Instance resource.""" + + @overload + def __init__( + self, + *, + message_server_properties: Optional["_models.MessageServerProperties"] = None, + enqueue_server_properties: Optional["_models.EnqueueServerProperties"] = None, + gateway_server_properties: Optional["_models.GatewayServerProperties"] = None, + enqueue_replication_server_properties: Optional["_models.EnqueueReplicationServerProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPDatabaseInstance(TrackedResource): + """Define the Database resource. + + Readonly 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}. # pylint: disable=line-too-long + :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.workloadssapvirtualinstance.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseProperties + """ + + properties: Optional["_models.SAPDatabaseProperties"] = rest_field() + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.SAPDatabaseProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPDatabaseProperties(_model_base.Model): + """Defines the Database properties. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar subnet: Database subnet. + :vartype subnet: str + :ivar database_sid: Database SID name. + :vartype database_sid: str + :ivar database_type: Database type, that is if the DB is HANA, DB2, Oracle, SAP ASE, Max DB or + MS SQL Server. + :vartype database_type: str + :ivar ip_address: Database IP Address. + :vartype ip_address: str + :ivar load_balancer_details: The Load Balancer details such as LoadBalancer ID attached to + Database Virtual Machines. + :vartype load_balancer_details: + ~azure.mgmt.workloadssapvirtualinstance.models.LoadBalancerDetails + :ivar vm_details: The list of virtual machines corresponding to the Database resource. + :vartype vm_details: list[~azure.mgmt.workloadssapvirtualinstance.models.DatabaseVmDetails] + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". + :vartype status: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceStatus + :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", + "Updating", "Creating", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SapVirtualInstanceProvisioningState + :ivar errors: Defines the errors related to Database resource. + :vartype errors: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceError + """ + + subnet: Optional[str] = rest_field(visibility=["read"]) + """Database subnet.""" + database_sid: Optional[str] = rest_field(name="databaseSid", visibility=["read"]) + """Database SID name.""" + database_type: Optional[str] = rest_field(name="databaseType", visibility=["read"]) + """Database type, that is if the DB is HANA, DB2, Oracle, SAP ASE, Max DB or MS SQL Server.""" + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read"]) + """Database IP Address.""" + load_balancer_details: Optional["_models.LoadBalancerDetails"] = rest_field( + name="loadBalancerDetails", visibility=["read"] + ) + """The Load Balancer details such as LoadBalancer ID attached to Database Virtual Machines.""" + vm_details: Optional[List["_models.DatabaseVmDetails"]] = rest_field(name="vmDetails", visibility=["read"]) + """The list of virtual machines corresponding to the Database resource.""" + status: Optional[Union[str, "_models.SAPVirtualInstanceStatus"]] = rest_field(visibility=["read"]) + """Defines the SAP Instance status. Known values are: \"Starting\", \"Running\", \"Stopping\", + \"Offline\", \"PartiallyRunning\", \"Unavailable\", and \"SoftShutdown\".""" + provisioning_state: Optional[Union[str, "_models.SapVirtualInstanceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Defines the provisioning states. Known values are: \"Succeeded\", \"Updating\", \"Creating\", + \"Failed\", \"Deleting\", and \"Canceled\".""" + errors: Optional["_models.SAPVirtualInstanceError"] = rest_field(visibility=["read"]) + """Defines the errors related to Database resource.""" + + +class SAPDiskConfiguration(_model_base.Model): + """The SAP Disk Configuration contains 'recommended disk' details and list of supported disks + detail for a volume type. + + :ivar recommended_configuration: The recommended disk details for a given VM Sku. + :vartype recommended_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.DiskVolumeConfiguration + :ivar supported_configurations: The list of supported disks for a given VM Sku. + :vartype supported_configurations: + list[~azure.mgmt.workloadssapvirtualinstance.models.DiskDetails] + """ + + recommended_configuration: Optional["_models.DiskVolumeConfiguration"] = rest_field(name="recommendedConfiguration") + """The recommended disk details for a given VM Sku.""" + supported_configurations: Optional[List["_models.DiskDetails"]] = rest_field(name="supportedConfigurations") + """The list of supported disks for a given VM Sku.""" + + @overload + def __init__( + self, + *, + recommended_configuration: Optional["_models.DiskVolumeConfiguration"] = None, + supported_configurations: Optional[List["_models.DiskDetails"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPDiskConfigurationsRequest(_model_base.Model): + """The SAP request to get list of disk configurations. + + All required parameters must be populated in order to send to server. + + :ivar app_location: The geo-location where the SAP resources will be created. Required. + :vartype app_location: str + :ivar environment: Defines the environment type - Production/Non Production. Required. Known + values are: "NonProd" and "Prod". + :vartype environment: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPEnvironmentType + :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", + and "Other". + :vartype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType + :ivar database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: "HANA" + and "DB2". + :vartype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType + :ivar deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known values + are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType + :ivar db_vm_sku: The VM SKU for database instance. Required. + :vartype db_vm_sku: str + """ + + app_location: str = rest_field(name="appLocation") + """The geo-location where the SAP resources will be created. Required.""" + environment: Union[str, "_models.SAPEnvironmentType"] = rest_field() + """Defines the environment type - Production/Non Production. Required. Known values are: + \"NonProd\" and \"Prod\".""" + sap_product: Union[str, "_models.SAPProductType"] = rest_field(name="sapProduct") + """Defines the SAP Product type. Required. Known values are: \"ECC\", \"S4HANA\", and \"Other\".""" + database_type: Union[str, "_models.SAPDatabaseType"] = rest_field(name="databaseType") + """The database type. Eg: HANA, DB2, etc. Required. Known values are: \"HANA\" and \"DB2\".""" + deployment_type: Union[str, "_models.SAPDeploymentType"] = rest_field(name="deploymentType") + """The deployment type. Eg: SingleServer/ThreeTier. Required. Known values are: \"SingleServer\" + and \"ThreeTier\".""" + db_vm_sku: str = rest_field(name="dbVmSku") + """The VM SKU for database instance. Required.""" + + @overload + def __init__( + self, + *, + app_location: str, + environment: Union[str, "_models.SAPEnvironmentType"], + sap_product: Union[str, "_models.SAPProductType"], + database_type: Union[str, "_models.SAPDatabaseType"], + deployment_type: Union[str, "_models.SAPDeploymentType"], + db_vm_sku: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPDiskConfigurationsResult(_model_base.Model): + """The list of disk configuration for vmSku which are part of SAP deployment. + + :ivar volume_configurations: The disk configuration for the db volume. For HANA, Required + volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : + ['backup']. + :vartype volume_configurations: dict[str, + ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfiguration] + """ + + volume_configurations: Optional[Dict[str, "_models.SAPDiskConfiguration"]] = rest_field(name="volumeConfigurations") + """The disk configuration for the db volume. For HANA, Required volumes are: ['hana/data', + 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : ['backup'].""" + + @overload + def __init__( + self, + *, + volume_configurations: Optional[Dict[str, "_models.SAPDiskConfiguration"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPInstallWithoutOSConfigSoftwareConfiguration( + SoftwareConfiguration, discriminator="SAPInstallWithoutOSConfig" +): # pylint: disable=name-too-long + """The SAP Software configuration Input when the software is to be installed by service without OS + Configurations. + + + :ivar bom_url: The URL to the SAP Build of Materials(BOM) file. Required. + :vartype bom_url: str + :ivar sap_bits_storage_account_id: The SAP bits storage account id. Required. + :vartype sap_bits_storage_account_id: str + :ivar software_version: The software version to install. Required. + :vartype software_version: str + :ivar high_availability_software_configuration: Gets or sets the HA software configuration. + :vartype high_availability_software_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.HighAvailabilitySoftwareConfiguration + :ivar software_installation_type: The SAP software installation Type. Required. SAP Install + without OS Config. + :vartype software_installation_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAP_INSTALL_WITHOUT_OS_CONFIG + """ + + bom_url: str = rest_field(name="bomUrl") + """The URL to the SAP Build of Materials(BOM) file. Required.""" + sap_bits_storage_account_id: str = rest_field(name="sapBitsStorageAccountId") + """The SAP bits storage account id. Required.""" + software_version: str = rest_field(name="softwareVersion") + """The software version to install. Required.""" + high_availability_software_configuration: Optional["_models.HighAvailabilitySoftwareConfiguration"] = rest_field( + name="highAvailabilitySoftwareConfiguration" + ) + """Gets or sets the HA software configuration.""" + software_installation_type: Literal[SAPSoftwareInstallationType.SAP_INSTALL_WITHOUT_OS_CONFIG] = rest_discriminator(name="softwareInstallationType") # type: ignore + """The SAP software installation Type. Required. SAP Install without OS Config.""" + + @overload + def __init__( + self, + *, + bom_url: str, + sap_bits_storage_account_id: str, + software_version: str, + high_availability_software_configuration: Optional["_models.HighAvailabilitySoftwareConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__( + *args, software_installation_type=SAPSoftwareInstallationType.SAP_INSTALL_WITHOUT_OS_CONFIG, **kwargs + ) + + +class SAPSizingRecommendationRequest(_model_base.Model): + """The SAP Sizing Recommendation request. + + All required parameters must be populated in order to send to server. + + :ivar app_location: The geo-location where the resource is to be created. Required. + :vartype app_location: str + :ivar environment: Defines the environment type - Production/Non Production. Required. Known + values are: "NonProd" and "Prod". + :vartype environment: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPEnvironmentType + :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", + and "Other". + :vartype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType + :ivar deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known values + are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType + :ivar saps: The SAP Application Performance Standard measurement. Required. + :vartype saps: int + :ivar db_memory: The database memory configuration. Required. + :vartype db_memory: int + :ivar database_type: The database type. Required. Known values are: "HANA" and "DB2". + :vartype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType + :ivar db_scale_method: The DB scale method. "ScaleUp" + :vartype db_scale_method: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseScaleMethod + :ivar high_availability_type: The high availability type. Known values are: "AvailabilitySet" + and "AvailabilityZone". + :vartype high_availability_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAPHighAvailabilityType + """ + + app_location: str = rest_field(name="appLocation") + """The geo-location where the resource is to be created. Required.""" + environment: Union[str, "_models.SAPEnvironmentType"] = rest_field() + """Defines the environment type - Production/Non Production. Required. Known values are: + \"NonProd\" and \"Prod\".""" + sap_product: Union[str, "_models.SAPProductType"] = rest_field(name="sapProduct") + """Defines the SAP Product type. Required. Known values are: \"ECC\", \"S4HANA\", and \"Other\".""" + deployment_type: Union[str, "_models.SAPDeploymentType"] = rest_field(name="deploymentType") + """The deployment type. Eg: SingleServer/ThreeTier. Required. Known values are: \"SingleServer\" + and \"ThreeTier\".""" + saps: int = rest_field() + """The SAP Application Performance Standard measurement. Required.""" + db_memory: int = rest_field(name="dbMemory") + """The database memory configuration. Required.""" + database_type: Union[str, "_models.SAPDatabaseType"] = rest_field(name="databaseType") + """The database type. Required. Known values are: \"HANA\" and \"DB2\".""" + db_scale_method: Optional[Union[str, "_models.SAPDatabaseScaleMethod"]] = rest_field(name="dbScaleMethod") + """The DB scale method. \"ScaleUp\"""" + high_availability_type: Optional[Union[str, "_models.SAPHighAvailabilityType"]] = rest_field( + name="highAvailabilityType" + ) + """The high availability type. Known values are: \"AvailabilitySet\" and \"AvailabilityZone\".""" + + @overload + def __init__( + self, + *, + app_location: str, + environment: Union[str, "_models.SAPEnvironmentType"], + sap_product: Union[str, "_models.SAPProductType"], + deployment_type: Union[str, "_models.SAPDeploymentType"], + saps: int, + db_memory: int, + database_type: Union[str, "_models.SAPDatabaseType"], + db_scale_method: Optional[Union[str, "_models.SAPDatabaseScaleMethod"]] = None, + high_availability_type: Optional[Union[str, "_models.SAPHighAvailabilityType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPSizingRecommendationResult(_model_base.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 + + + :ivar deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known values + are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType + """ + + __mapping__: Dict[str, _model_base.Model] = {} + deployment_type: str = rest_discriminator(name="deploymentType") + """The deployment type. Eg: SingleServer/ThreeTier. Required. Known values are: \"SingleServer\" + and \"ThreeTier\".""" + + @overload + def __init__( + self, + *, + deployment_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPSupportedResourceSkusResult(_model_base.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.workloadssapvirtualinstance.models.SAPSupportedSku] + """ + + supported_skus: Optional[List["_models.SAPSupportedSku"]] = rest_field(name="supportedSkus") + """Gets the list of SAP supported SKUs.""" + + @overload + def __init__( + self, + *, + supported_skus: Optional[List["_models.SAPSupportedSku"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPSupportedSku(_model_base.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 + """ + + vm_sku: Optional[str] = rest_field(name="vmSku") + """The VM Sku.""" + is_app_server_certified: Optional[bool] = rest_field(name="isAppServerCertified") + """True if the Sku is certified for App server in the SAP system.""" + is_database_certified: Optional[bool] = rest_field(name="isDatabaseCertified") + """True if the Sku is certified for Database server in the SAP system.""" + + @overload + def __init__( + self, + *, + vm_sku: Optional[str] = None, + is_app_server_certified: Optional[bool] = None, + is_database_certified: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPSupportedSkusRequest(_model_base.Model): + """The SAP request to get list of supported SKUs. + + All required parameters must be populated in order to send to server. + + :ivar app_location: The geo-location where the resource is to be created. Required. + :vartype app_location: str + :ivar environment: Defines the environment type - Production/Non Production. Required. Known + values are: "NonProd" and "Prod". + :vartype environment: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPEnvironmentType + :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", + and "Other". + :vartype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType + :ivar deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known values + are: "SingleServer" and "ThreeTier". + :vartype deployment_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType + :ivar database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: "HANA" + and "DB2". + :vartype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType + :ivar high_availability_type: The high availability type. Known values are: "AvailabilitySet" + and "AvailabilityZone". + :vartype high_availability_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAPHighAvailabilityType + """ + + app_location: str = rest_field(name="appLocation") + """The geo-location where the resource is to be created. Required.""" + environment: Union[str, "_models.SAPEnvironmentType"] = rest_field() + """Defines the environment type - Production/Non Production. Required. Known values are: + \"NonProd\" and \"Prod\".""" + sap_product: Union[str, "_models.SAPProductType"] = rest_field(name="sapProduct") + """Defines the SAP Product type. Required. Known values are: \"ECC\", \"S4HANA\", and \"Other\".""" + deployment_type: Union[str, "_models.SAPDeploymentType"] = rest_field(name="deploymentType") + """The deployment type. Eg: SingleServer/ThreeTier. Required. Known values are: \"SingleServer\" + and \"ThreeTier\".""" + database_type: Union[str, "_models.SAPDatabaseType"] = rest_field(name="databaseType") + """The database type. Eg: HANA, DB2, etc. Required. Known values are: \"HANA\" and \"DB2\".""" + high_availability_type: Optional[Union[str, "_models.SAPHighAvailabilityType"]] = rest_field( + name="highAvailabilityType" + ) + """The high availability type. Known values are: \"AvailabilitySet\" and \"AvailabilityZone\".""" + + @overload + def __init__( + self, + *, + app_location: str, + environment: Union[str, "_models.SAPEnvironmentType"], + sap_product: Union[str, "_models.SAPProductType"], + deployment_type: Union[str, "_models.SAPDeploymentType"], + database_type: Union[str, "_models.SAPDatabaseType"], + high_availability_type: Optional[Union[str, "_models.SAPHighAvailabilityType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPVirtualInstance(TrackedResource): + """Define the Virtual Instance for SAP solutions resource. + + Readonly 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}. # pylint: disable=line-too-long + :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.workloadssapvirtualinstance.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: + ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceProperties + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceIdentity + """ + + properties: Optional["_models.SAPVirtualInstanceProperties"] = rest_field() + """The resource-specific properties for this resource.""" + identity: Optional["_models.SAPVirtualInstanceIdentity"] = rest_field() + """The managed service identities assigned to this resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.SAPVirtualInstanceProperties"] = None, + identity: Optional["_models.SAPVirtualInstanceIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPVirtualInstanceError(_model_base.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.workloadssapvirtualinstance.models.ErrorDefinition + """ + + properties: Optional["_models.ErrorDefinition"] = rest_field() + """The Virtual Instance for SAP error body.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ErrorDefinition"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPVirtualInstanceIdentity(_model_base.Model): + """Managed service identity (user assigned identities). + + + :ivar type: The type of managed identity assigned to this resource. Required. Known values are: + "None" and "UserAssigned". + :vartype type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceIdentityType + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.workloadssapvirtualinstance.models.UserAssignedIdentity] + """ + + type: Union[str, "_models.SAPVirtualInstanceIdentityType"] = rest_field() + """The type of managed identity assigned to this resource. Required. Known values are: \"None\" + and \"UserAssigned\".""" + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities" + ) + """The identities assigned to this resource by the user.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.SAPVirtualInstanceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SAPVirtualInstanceProperties(_model_base.Model): + """Defines the Virtual Instance for SAP solutions resource properties. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + + :ivar environment: Defines the environment type - Production/Non Production. Required. Known + values are: "NonProd" and "Prod". + :vartype environment: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPEnvironmentType + :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", + and "Other". + :vartype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType + :ivar managed_resources_network_access_type: Specifies the network access configuration for the + resources that will be deployed in the Managed Resource Group. The options to choose from are + Public and Private. If 'Private' is chosen, the Storage Account service tag should be enabled + on the subnets in which the SAP VMs exist. This is required for establishing connectivity + between VM extensions and the managed resource group storage account. This setting is currently + applicable only to Storage Account. Learn more here + https://go.microsoft.com/fwlink/?linkid=2247228. Known values are: "Public" and "Private". + :vartype managed_resources_network_access_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.ManagedResourcesNetworkAccessType + :ivar configuration: Defines if the SAP system is being created using Azure Center for SAP + solutions (ACSS) or if an existing SAP system is being registered with ACSS. Required. + :vartype configuration: ~azure.mgmt.workloadssapvirtualinstance.models.SAPConfiguration + :ivar managed_resource_group_configuration: Managed resource group configuration. + :vartype managed_resource_group_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.ManagedRGConfiguration + :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", + "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". + :vartype status: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceStatus + :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", + "Unhealthy", and "Degraded". + :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPHealthState + :ivar state: Defines the Virtual Instance for SAP state. Known values are: + "InfrastructureDeploymentPending", "InfrastructureDeploymentInProgress", + "InfrastructureDeploymentFailed", "SoftwareInstallationPending", + "SoftwareInstallationInProgress", "SoftwareInstallationFailed", "SoftwareDetectionInProgress", + "SoftwareDetectionFailed", "DiscoveryPending", "DiscoveryInProgress", "DiscoveryFailed", + "RegistrationComplete", and "ACSSInstallationBlocked". + :vartype state: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceState + :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", + "Updating", "Creating", "Failed", "Deleting", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SapVirtualInstanceProvisioningState + :ivar errors: Indicates any errors on the Virtual Instance for SAP solutions resource. + :vartype errors: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceError + """ + + environment: Union[str, "_models.SAPEnvironmentType"] = rest_field(visibility=["read", "create"]) + """Defines the environment type - Production/Non Production. Required. Known values are: + \"NonProd\" and \"Prod\".""" + sap_product: Union[str, "_models.SAPProductType"] = rest_field(name="sapProduct", visibility=["read", "create"]) + """Defines the SAP Product type. Required. Known values are: \"ECC\", \"S4HANA\", and \"Other\".""" + managed_resources_network_access_type: Optional[Union[str, "_models.ManagedResourcesNetworkAccessType"]] = ( + rest_field(name="managedResourcesNetworkAccessType") + ) + """Specifies the network access configuration for the resources that will be deployed in the + Managed Resource Group. The options to choose from are Public and Private. If 'Private' is + chosen, the Storage Account service tag should be enabled on the subnets in which the SAP VMs + exist. This is required for establishing connectivity between VM extensions and the managed + resource group storage account. This setting is currently applicable only to Storage Account. + Learn more here https://go.microsoft.com/fwlink/?linkid=2247228. Known values are: \"Public\" + and \"Private\".""" + configuration: "_models.SAPConfiguration" = rest_field() + """Defines if the SAP system is being created using Azure Center for SAP solutions (ACSS) or if an + existing SAP system is being registered with ACSS. Required.""" + managed_resource_group_configuration: Optional["_models.ManagedRGConfiguration"] = rest_field( + name="managedResourceGroupConfiguration" + ) + """Managed resource group configuration.""" + status: Optional[Union[str, "_models.SAPVirtualInstanceStatus"]] = rest_field(visibility=["read"]) + """Defines the SAP Instance status. Known values are: \"Starting\", \"Running\", \"Stopping\", + \"Offline\", \"PartiallyRunning\", \"Unavailable\", and \"SoftShutdown\".""" + health: Optional[Union[str, "_models.SAPHealthState"]] = rest_field(visibility=["read"]) + """Defines the health of SAP Instances. Known values are: \"Unknown\", \"Healthy\", \"Unhealthy\", + and \"Degraded\".""" + state: Optional[Union[str, "_models.SAPVirtualInstanceState"]] = rest_field(visibility=["read"]) + """Defines the Virtual Instance for SAP state. Known values are: + \"InfrastructureDeploymentPending\", \"InfrastructureDeploymentInProgress\", + \"InfrastructureDeploymentFailed\", \"SoftwareInstallationPending\", + \"SoftwareInstallationInProgress\", \"SoftwareInstallationFailed\", + \"SoftwareDetectionInProgress\", \"SoftwareDetectionFailed\", \"DiscoveryPending\", + \"DiscoveryInProgress\", \"DiscoveryFailed\", \"RegistrationComplete\", and + \"ACSSInstallationBlocked\".""" + provisioning_state: Optional[Union[str, "_models.SapVirtualInstanceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Defines the provisioning states. Known values are: \"Succeeded\", \"Updating\", \"Creating\", + \"Failed\", \"Deleting\", and \"Canceled\".""" + errors: Optional["_models.SAPVirtualInstanceError"] = rest_field(visibility=["read"]) + """Indicates any errors on the Virtual Instance for SAP solutions resource.""" + + @overload + def __init__( + self, + *, + environment: Union[str, "_models.SAPEnvironmentType"], + sap_product: Union[str, "_models.SAPProductType"], + configuration: "_models.SAPConfiguration", + managed_resources_network_access_type: Optional[Union[str, "_models.ManagedResourcesNetworkAccessType"]] = None, + managed_resource_group_configuration: Optional["_models.ManagedRGConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceInitiatedSoftwareConfiguration(SoftwareConfiguration, discriminator="ServiceInitiated"): + """The SAP Software configuration Input when the software is to be installed by service. + + + :ivar bom_url: The URL to the SAP Build of Materials(BOM) file. Required. + :vartype bom_url: str + :ivar software_version: The software version to install. Required. + :vartype software_version: str + :ivar sap_bits_storage_account_id: The SAP bits storage account id. Required. + :vartype sap_bits_storage_account_id: str + :ivar sap_fqdn: The FQDN to set for the SAP system during install. Required. + :vartype sap_fqdn: str + :ivar ssh_private_key: The SSH private key. Required. + :vartype ssh_private_key: str + :ivar high_availability_software_configuration: Gets or sets the HA software configuration. + :vartype high_availability_software_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.HighAvailabilitySoftwareConfiguration + :ivar software_installation_type: The SAP software installation Type, service initiated in this + case. Required. SAP Install managed by service. + :vartype software_installation_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.SERVICE_INITIATED + """ + + bom_url: str = rest_field(name="bomUrl") + """The URL to the SAP Build of Materials(BOM) file. Required.""" + software_version: str = rest_field(name="softwareVersion") + """The software version to install. Required.""" + sap_bits_storage_account_id: str = rest_field(name="sapBitsStorageAccountId") + """The SAP bits storage account id. Required.""" + sap_fqdn: str = rest_field(name="sapFqdn") + """The FQDN to set for the SAP system during install. Required.""" + ssh_private_key: str = rest_field(name="sshPrivateKey") + """The SSH private key. Required.""" + high_availability_software_configuration: Optional["_models.HighAvailabilitySoftwareConfiguration"] = rest_field( + name="highAvailabilitySoftwareConfiguration" + ) + """Gets or sets the HA software configuration.""" + software_installation_type: Literal[SAPSoftwareInstallationType.SERVICE_INITIATED] = rest_discriminator(name="softwareInstallationType") # type: ignore + """The SAP software installation Type, service initiated in this case. Required. SAP Install + managed by service.""" + + @overload + 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["_models.HighAvailabilitySoftwareConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, software_installation_type=SAPSoftwareInstallationType.SERVICE_INITIATED, **kwargs) + + +class SharedStorageResourceNames(_model_base.Model): + """The resource names object for shared storage. + + :ivar shared_storage_account_name: The full name of the shared storage account. If it is not + provided, it will be defaulted to {SID}nfs{guid of 15 chars}. + :vartype shared_storage_account_name: str + :ivar shared_storage_account_private_end_point_name: The full name of private end point for the + shared storage account. If it is not provided, it will be defaulted to {storageAccountName}_pe. + :vartype shared_storage_account_private_end_point_name: str + """ + + shared_storage_account_name: Optional[str] = rest_field(name="sharedStorageAccountName") + """The full name of the shared storage account. If it is not provided, it will be defaulted to + {SID}nfs{guid of 15 chars}.""" + shared_storage_account_private_end_point_name: Optional[str] = rest_field( + name="sharedStorageAccountPrivateEndPointName" + ) + """The full name of private end point for the shared storage account. If it is not provided, it + will be defaulted to {storageAccountName}_pe.""" + + @overload + def __init__( + self, + *, + shared_storage_account_name: Optional[str] = None, + shared_storage_account_private_end_point_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SingleServerConfiguration(InfrastructureConfiguration, discriminator="SingleServer"): + """Gets or sets the single server configuration. For prerequisites for creating the + infrastructure, please see `here + `_. + + + :ivar app_resource_group: The application resource group where SAP system resources will be + deployed. Required. + :vartype app_resource_group: str + :ivar network_configuration: Network configuration for the server. + :vartype network_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.NetworkConfiguration + :ivar database_type: The database type. Known values are: "HANA" and "DB2". + :vartype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType + :ivar subnet_id: The subnet id. Required. + :vartype subnet_id: str + :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. + :vartype virtual_machine_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineConfiguration + :ivar db_disk_configuration: Gets or sets the disk configuration. + :vartype db_disk_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.DiskConfiguration + :ivar custom_resource_names: The set of custom names to be used for underlying azure resources + that are part of the SAP system. + :vartype custom_resource_names: + ~azure.mgmt.workloadssapvirtualinstance.models.SingleServerCustomResourceNames + :ivar deployment_type: The type of SAP deployment, single server in this case. Required. SAP + Single server deployment type. + :vartype deployment_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SINGLE_SERVER + """ + + network_configuration: Optional["_models.NetworkConfiguration"] = rest_field(name="networkConfiguration") + """Network configuration for the server.""" + database_type: Optional[Union[str, "_models.SAPDatabaseType"]] = rest_field(name="databaseType") + """The database type. Known values are: \"HANA\" and \"DB2\".""" + subnet_id: str = rest_field(name="subnetId") + """The subnet id. Required.""" + virtual_machine_configuration: "_models.VirtualMachineConfiguration" = rest_field( + name="virtualMachineConfiguration" + ) + """Gets or sets the virtual machine configuration. Required.""" + db_disk_configuration: Optional["_models.DiskConfiguration"] = rest_field(name="dbDiskConfiguration") + """Gets or sets the disk configuration.""" + custom_resource_names: Optional["_models.SingleServerCustomResourceNames"] = rest_field(name="customResourceNames") + """The set of custom names to be used for underlying azure resources that are part of the SAP + system.""" + deployment_type: Literal[SAPDeploymentType.SINGLE_SERVER] = rest_discriminator(name="deploymentType") # type: ignore # pylint: disable=line-too-long + """The type of SAP deployment, single server in this case. Required. SAP Single server deployment + type.""" + + @overload + def __init__( + self, + *, + app_resource_group: str, + subnet_id: str, + virtual_machine_configuration: "_models.VirtualMachineConfiguration", + network_configuration: Optional["_models.NetworkConfiguration"] = None, + database_type: Optional[Union[str, "_models.SAPDatabaseType"]] = None, + db_disk_configuration: Optional["_models.DiskConfiguration"] = None, + custom_resource_names: Optional["_models.SingleServerCustomResourceNames"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, deployment_type=SAPDeploymentType.SINGLE_SERVER, **kwargs) + + +class SingleServerCustomResourceNames(_model_base.Model): + """The resource-names input to specify custom names for underlying azure resources that are part + of a single server SAP system. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SingleServerFullResourceNames + + + :ivar naming_pattern_type: The naming pattern type. Required. "FullResourceName" + :vartype naming_pattern_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.NamingPatternType + """ + + __mapping__: Dict[str, _model_base.Model] = {} + naming_pattern_type: str = rest_discriminator(name="namingPatternType") + """The naming pattern type. Required. \"FullResourceName\"""" + + @overload + def __init__( + self, + *, + naming_pattern_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SingleServerFullResourceNames(SingleServerCustomResourceNames, discriminator="FullResourceName"): + """The resource name object where the specified values will be full resource names of the + corresponding resources in a single server SAP system. + + + :ivar virtual_machine: The resource names object for virtual machine and related resources. + :vartype virtual_machine: + ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineResourceNames + :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. Full + resource names that will be created by service. + :vartype naming_pattern_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.FULL_RESOURCE_NAME + """ + + virtual_machine: Optional["_models.VirtualMachineResourceNames"] = rest_field(name="virtualMachine") + """The resource names object for virtual machine and related resources.""" + naming_pattern_type: Literal[NamingPatternType.FULL_RESOURCE_NAME] = rest_discriminator(name="namingPatternType") # type: ignore # pylint: disable=line-too-long + """The pattern type to be used for resource naming. Required. Full resource names that will be + created by service.""" + + @overload + def __init__( + self, + *, + virtual_machine: Optional["_models.VirtualMachineResourceNames"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, naming_pattern_type=NamingPatternType.FULL_RESOURCE_NAME, **kwargs) + + +class SingleServerRecommendationResult(SAPSizingRecommendationResult, discriminator="SingleServer"): + """The recommended configuration for a single server SAP system. + + + :ivar vm_sku: The recommended VM SKU for single server. + :vartype vm_sku: str + :ivar deployment_type: The single server SAP deployment type. Required. SAP Single server + deployment type. + :vartype deployment_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SINGLE_SERVER + """ + + vm_sku: Optional[str] = rest_field(name="vmSku") + """The recommended VM SKU for single server.""" + deployment_type: Literal[SAPDeploymentType.SINGLE_SERVER] = rest_discriminator(name="deploymentType") # type: ignore # pylint: disable=line-too-long + """The single server SAP deployment type. Required. SAP Single server deployment type.""" + + @overload + def __init__( + self, + *, + vm_sku: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, deployment_type=SAPDeploymentType.SINGLE_SERVER, **kwargs) + + +class SkipFileShareConfiguration(FileShareConfiguration, discriminator="Skip"): + """Gets or sets the file share configuration for scenarios where transport directory fileshare is + not created or required. + + + :ivar configuration_type: The type of file share config, skip in this case i.e. fileshare is + not created or required. Required. Skip creating the file share. + :vartype configuration_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SKIP + """ + + configuration_type: Literal[FileShareConfigurationType.SKIP] = rest_discriminator(name="configurationType") # type: ignore # pylint: disable=line-too-long + """The type of file share config, skip in this case i.e. fileshare is not created or required. + Required. Skip creating the file share.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, configuration_type=FileShareConfigurationType.SKIP, **kwargs) + + +class SshConfiguration(_model_base.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.workloadssapvirtualinstance.models.SshPublicKey] + """ + + public_keys: Optional[List["_models.SshPublicKey"]] = rest_field(name="publicKeys") + """The list of SSH public keys used to authenticate with linux based VMs.""" + + @overload + def __init__( + self, + *, + public_keys: Optional[List["_models.SshPublicKey"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SshKeyPair(_model_base.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. 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 + """ + + public_key: Optional[str] = rest_field(name="publicKey") + """SSH public key.""" + private_key: Optional[str] = rest_field(name="privateKey") + """SSH private key.""" + + @overload + def __init__( + self, + *, + public_key: Optional[str] = None, + private_key: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SshPublicKey(_model_base.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 + """ + + key_data: Optional[str] = rest_field(name="keyData") + """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 + `_.""" + + @overload + def __init__( + self, + *, + key_data: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StartRequest(_model_base.Model): + """Start SAP instance(s) request body. + + :ivar start_vm: The boolean value indicates whether to start the virtual machines before + starting the SAP instances. + :vartype start_vm: bool + """ + + start_vm: Optional[bool] = rest_field(name="startVm") + """The boolean value indicates whether to start the virtual machines before starting the SAP + instances.""" + + @overload + def __init__( + self, + *, + start_vm: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StopRequest(_model_base.Model): + """Stop SAP instance(s) request body. + + :ivar soft_stop_timeout_seconds: This parameter defines how long (in seconds) the soft shutdown + waits until the RFC/HTTP clients no longer consider the server for calls with load balancing. + Value 0 means that the kernel does not wait, but goes directly into the next shutdown state, + i.e. hard stop. + :vartype soft_stop_timeout_seconds: int + :ivar deallocate_vm: The boolean value indicates whether to Stop and deallocate the virtual + machines along with the SAP instances. + :vartype deallocate_vm: bool + """ + + soft_stop_timeout_seconds: Optional[int] = rest_field(name="softStopTimeoutSeconds") + """This parameter defines how long (in seconds) the soft shutdown waits until the RFC/HTTP clients + no longer consider the server for calls with load balancing. Value 0 means that the kernel does + not wait, but goes directly into the next shutdown state, i.e. hard stop.""" + deallocate_vm: Optional[bool] = rest_field(name="deallocateVm") + """The boolean value indicates whether to Stop and deallocate the virtual machines along with the + SAP instances.""" + + @overload + def __init__( + self, + *, + soft_stop_timeout_seconds: Optional[int] = None, + deallocate_vm: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageConfiguration(_model_base.Model): + """Gets or sets the storage configuration. + + :ivar transport_file_share_configuration: The properties of the transport directory attached to + the VIS. The default for transportFileShareConfiguration is the createAndMount flow if storage + configuration is missing. + :vartype transport_file_share_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.FileShareConfiguration + """ + + transport_file_share_configuration: Optional["_models.FileShareConfiguration"] = rest_field( + name="transportFileShareConfiguration" + ) + """The properties of the transport directory attached to the VIS. The default for + transportFileShareConfiguration is the createAndMount flow if storage configuration is missing.""" + + @overload + def __init__( + self, + *, + transport_file_share_configuration: Optional["_models.FileShareConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageInformation(_model_base.Model): + """Storage details of all the Storage accounts attached to the VM. For e.g. NFS on AFS Shared + Storage. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the storage account. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the storage account.""" + + +class SystemData(_model_base.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. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy") + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="createdByType") + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field(name="createdAt", format="rfc3339") + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field(name="lastModifiedBy") + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="lastModifiedByType") + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field(name="lastModifiedAt", format="rfc3339") + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ThreeTierConfiguration(InfrastructureConfiguration, discriminator="ThreeTier"): + """Gets or sets the three tier SAP configuration. For prerequisites for creating the + infrastructure, please see `here + `_. + + + :ivar app_resource_group: The application resource group where SAP system resources will be + deployed. Required. + :vartype app_resource_group: str + :ivar network_configuration: Network configuration common to all servers. + :vartype network_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.NetworkConfiguration + :ivar central_server: The central server configuration. Required. + :vartype central_server: + ~azure.mgmt.workloadssapvirtualinstance.models.CentralServerConfiguration + :ivar application_server: The application server configuration. Required. + :vartype application_server: + ~azure.mgmt.workloadssapvirtualinstance.models.ApplicationServerConfiguration + :ivar database_server: The database configuration. Required. + :vartype database_server: ~azure.mgmt.workloadssapvirtualinstance.models.DatabaseConfiguration + :ivar high_availability_config: The high availability configuration. + :vartype high_availability_config: + ~azure.mgmt.workloadssapvirtualinstance.models.HighAvailabilityConfiguration + :ivar storage_configuration: The storage configuration. + :vartype storage_configuration: + ~azure.mgmt.workloadssapvirtualinstance.models.StorageConfiguration + :ivar custom_resource_names: The set of custom names to be used for underlying azure resources + that are part of the SAP system. + :vartype custom_resource_names: + ~azure.mgmt.workloadssapvirtualinstance.models.ThreeTierCustomResourceNames + :ivar deployment_type: The type of SAP deployment, ThreeTier in this case. Required. SAP + Distributed deployment type. + :vartype deployment_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.THREE_TIER + """ + + network_configuration: Optional["_models.NetworkConfiguration"] = rest_field(name="networkConfiguration") + """Network configuration common to all servers.""" + central_server: "_models.CentralServerConfiguration" = rest_field(name="centralServer") + """The central server configuration. Required.""" + application_server: "_models.ApplicationServerConfiguration" = rest_field(name="applicationServer") + """The application server configuration. Required.""" + database_server: "_models.DatabaseConfiguration" = rest_field(name="databaseServer") + """The database configuration. Required.""" + high_availability_config: Optional["_models.HighAvailabilityConfiguration"] = rest_field( + name="highAvailabilityConfig" + ) + """The high availability configuration.""" + storage_configuration: Optional["_models.StorageConfiguration"] = rest_field(name="storageConfiguration") + """The storage configuration.""" + custom_resource_names: Optional["_models.ThreeTierCustomResourceNames"] = rest_field(name="customResourceNames") + """The set of custom names to be used for underlying azure resources that are part of the SAP + system.""" + deployment_type: Literal[SAPDeploymentType.THREE_TIER] = rest_discriminator(name="deploymentType") # type: ignore + """The type of SAP deployment, ThreeTier in this case. Required. SAP Distributed deployment type.""" + + @overload + def __init__( + self, + *, + app_resource_group: str, + central_server: "_models.CentralServerConfiguration", + application_server: "_models.ApplicationServerConfiguration", + database_server: "_models.DatabaseConfiguration", + network_configuration: Optional["_models.NetworkConfiguration"] = None, + high_availability_config: Optional["_models.HighAvailabilityConfiguration"] = None, + storage_configuration: Optional["_models.StorageConfiguration"] = None, + custom_resource_names: Optional["_models.ThreeTierCustomResourceNames"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, deployment_type=SAPDeploymentType.THREE_TIER, **kwargs) + + +class ThreeTierCustomResourceNames(_model_base.Model): + """The resource-names input to specify custom names for underlying azure resources that are part + of a three tier SAP system. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ThreeTierFullResourceNames + + + :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. + "FullResourceName" + :vartype naming_pattern_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.NamingPatternType + """ + + __mapping__: Dict[str, _model_base.Model] = {} + naming_pattern_type: str = rest_discriminator(name="namingPatternType") + """The pattern type to be used for resource naming. Required. \"FullResourceName\"""" + + @overload + def __init__( + self, + *, + naming_pattern_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ThreeTierFullResourceNames(ThreeTierCustomResourceNames, discriminator="FullResourceName"): + """The resource name object where the specified values will be full resource names of the + corresponding resources in a three tier SAP system. + + + :ivar central_server: The full resource names object for central server layer resources. + :vartype central_server: + ~azure.mgmt.workloadssapvirtualinstance.models.CentralServerFullResourceNames + :ivar application_server: The full resource names object for application layer resources. The + number of entries in this list should be equal to the number VMs to be created for application + layer. + :vartype application_server: + ~azure.mgmt.workloadssapvirtualinstance.models.ApplicationServerFullResourceNames + :ivar database_server: The full resource names object for database layer resources. The number + of entries in this list should be equal to the number VMs to be created for database layer. + :vartype database_server: + ~azure.mgmt.workloadssapvirtualinstance.models.DatabaseServerFullResourceNames + :ivar shared_storage: The resource names object for shared storage. + :vartype shared_storage: + ~azure.mgmt.workloadssapvirtualinstance.models.SharedStorageResourceNames + :ivar naming_pattern_type: The pattern type to be used for resource naming, FullResourceName in + this case. Required. Full resource names that will be created by service. + :vartype naming_pattern_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.FULL_RESOURCE_NAME + """ + + central_server: Optional["_models.CentralServerFullResourceNames"] = rest_field(name="centralServer") + """The full resource names object for central server layer resources.""" + application_server: Optional["_models.ApplicationServerFullResourceNames"] = rest_field(name="applicationServer") + """The full resource names object for application layer resources. The number of entries in this + list should be equal to the number VMs to be created for application layer.""" + database_server: Optional["_models.DatabaseServerFullResourceNames"] = rest_field(name="databaseServer") + """The full resource names object for database layer resources. The number of entries in this list + should be equal to the number VMs to be created for database layer.""" + shared_storage: Optional["_models.SharedStorageResourceNames"] = rest_field(name="sharedStorage") + """The resource names object for shared storage.""" + naming_pattern_type: Literal[NamingPatternType.FULL_RESOURCE_NAME] = rest_discriminator(name="namingPatternType") # type: ignore # pylint: disable=line-too-long + """The pattern type to be used for resource naming, FullResourceName in this case. Required. Full + resource names that will be created by service.""" + + @overload + def __init__( + self, + *, + central_server: Optional["_models.CentralServerFullResourceNames"] = None, + application_server: Optional["_models.ApplicationServerFullResourceNames"] = None, + database_server: Optional["_models.DatabaseServerFullResourceNames"] = None, + shared_storage: Optional["_models.SharedStorageResourceNames"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, naming_pattern_type=NamingPatternType.FULL_RESOURCE_NAME, **kwargs) + + +class ThreeTierRecommendationResult(SAPSizingRecommendationResult, discriminator="ThreeTier"): + """The recommended configuration for a three tier SAP system. + + + :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: int + :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: int + :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: int + :ivar deployment_type: The three tier SAP deployment type. Required. SAP Distributed deployment + type. + :vartype deployment_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.THREE_TIER + """ + + db_vm_sku: Optional[str] = rest_field(name="dbVmSku") + """The database VM SKU.""" + database_instance_count: Optional[int] = rest_field(name="databaseInstanceCount") + """The database server instance count.""" + central_server_vm_sku: Optional[str] = rest_field(name="centralServerVmSku") + """The central server VM SKU.""" + central_server_instance_count: Optional[int] = rest_field(name="centralServerInstanceCount") + """The central server instance count.""" + application_server_vm_sku: Optional[str] = rest_field(name="applicationServerVmSku") + """The application server VM SKU.""" + application_server_instance_count: Optional[int] = rest_field(name="applicationServerInstanceCount") + """The application server instance count.""" + deployment_type: Literal[SAPDeploymentType.THREE_TIER] = rest_discriminator(name="deploymentType") # type: ignore + """The three tier SAP deployment type. Required. SAP Distributed deployment type.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, deployment_type=SAPDeploymentType.THREE_TIER, **kwargs) + + +class UpdateSAPApplicationInstanceRequest(_model_base.Model): + """Defines the request body for updating SAP Application Instance. + + :ivar tags: Gets or sets the Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[Dict[str, str]] = rest_field() + """Gets or sets the Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UpdateSAPCentralInstanceRequest(_model_base.Model): + """Defines the request body for updating SAP Central Instance. + + :ivar tags: Gets or sets the Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[Dict[str, str]] = rest_field() + """Gets or sets the Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UpdateSAPDatabaseInstanceRequest(_model_base.Model): + """Defines the request body for updating SAP Database Instance. + + :ivar tags: Gets or sets the Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[Dict[str, str]] = rest_field() + """Gets or sets the Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UpdateSAPVirtualInstanceProperties(_model_base.Model): + """Defines the update request body properties for updating Virtual Instance for SAP. + + :ivar managed_resources_network_access_type: Specifies the network access configuration for the + resources that will be deployed in the Managed Resource Group. The options to choose from are + Public and Private. If 'Private' is chosen, the Storage Account service tag should be enabled + on the subnets in which the SAP VMs exist. This is required for establishing connectivity + between VM extensions and the managed resource group storage account. This setting is currently + applicable only to Storage Account. Learn more here + https://go.microsoft.com/fwlink/?linkid=2247228. Known values are: "Public" and "Private". + :vartype managed_resources_network_access_type: str or + ~azure.mgmt.workloadssapvirtualinstance.models.ManagedResourcesNetworkAccessType + """ + + managed_resources_network_access_type: Optional[Union[str, "_models.ManagedResourcesNetworkAccessType"]] = ( + rest_field(name="managedResourcesNetworkAccessType") + ) + """Specifies the network access configuration for the resources that will be deployed in the + Managed Resource Group. The options to choose from are Public and Private. If 'Private' is + chosen, the Storage Account service tag should be enabled on the subnets in which the SAP VMs + exist. This is required for establishing connectivity between VM extensions and the managed + resource group storage account. This setting is currently applicable only to Storage Account. + Learn more here https://go.microsoft.com/fwlink/?linkid=2247228. Known values are: \"Public\" + and \"Private\".""" + + @overload + def __init__( + self, + *, + managed_resources_network_access_type: Optional[Union[str, "_models.ManagedResourcesNetworkAccessType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UpdateSAPVirtualInstanceRequest(_model_base.Model): + """Defines the request body for updating Virtual Instance for SAP. + + :ivar tags: Gets or sets the Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed service identity (user assigned identities). + :vartype identity: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceIdentity + :ivar properties: The update properties. + :vartype properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPVirtualInstanceProperties + """ + + tags: Optional[Dict[str, str]] = rest_field() + """Gets or sets the Resource tags.""" + identity: Optional["_models.SAPVirtualInstanceIdentity"] = rest_field() + """Managed service identity (user assigned identities).""" + properties: Optional["_models.UpdateSAPVirtualInstanceProperties"] = rest_field() + """The update properties.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.SAPVirtualInstanceIdentity"] = None, + properties: Optional["_models.UpdateSAPVirtualInstanceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserAssignedIdentity(_model_base.Model): + """User assigned identity properties. + + Readonly 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 + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client ID of the assigned identity.""" + + +class VirtualMachineConfiguration(_model_base.Model): + """Defines the virtual machine configuration. + + + :ivar vm_size: The virtual machine size. Required. + :vartype vm_size: str + :ivar image_reference: The image reference. Required. + :vartype image_reference: ~azure.mgmt.workloadssapvirtualinstance.models.ImageReference + :ivar os_profile: The OS profile. Required. + :vartype os_profile: ~azure.mgmt.workloadssapvirtualinstance.models.OSProfile + """ + + vm_size: str = rest_field(name="vmSize") + """The virtual machine size. Required.""" + image_reference: "_models.ImageReference" = rest_field(name="imageReference") + """The image reference. Required.""" + os_profile: "_models.OSProfile" = rest_field(name="osProfile") + """The OS profile. Required.""" + + @overload + def __init__( + self, + *, + vm_size: str, + image_reference: "_models.ImageReference", + os_profile: "_models.OSProfile", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualMachineResourceNames(_model_base.Model): + """The resource names object for virtual machine and related resources. + + :ivar vm_name: The full name for virtual machine. The length of this field can be upto 64 + characters. If name is not provided, service uses a default name based on the deployment type. + For SingleServer, default name is {SID}vm. In case of HA-AvZone systems, default name will be + {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end in case of more than 1 vm per layer. + For distributed and HA-AvSet systems, default name will be {SID}{app/ascs/db}vm with an + incrementor at the end in case of more than 1 vm per layer. + :vartype vm_name: str + :ivar host_name: The full name for virtual-machine's host (computer name). Currently, ACSS only + supports host names which are less than or equal to 13 characters long. If this value is not + provided, vmName will be used as host name. + :vartype host_name: str + :ivar network_interfaces: The list of network interface name objects for the selected virtual + machine. Currently, only one network interface is supported per virtual machine. + :vartype network_interfaces: + list[~azure.mgmt.workloadssapvirtualinstance.models.NetworkInterfaceResourceNames] + :ivar os_disk_name: The full name for OS disk attached to the VM. If this value is not + provided, it will be named by ARM as per its default naming standards (prefixed with vm name). + There is only one OS disk attached per Virtual Machine. + :vartype os_disk_name: str + :ivar data_disk_names: The full resource names for virtual machine data disks. This is a + dictionary containing list of names of data disks per volume. Currently supported volumes for + database layer are ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For + application and cs layers, only 'default' volume is supported. + :vartype data_disk_names: dict[str, list[str]] + """ + + vm_name: Optional[str] = rest_field(name="vmName") + """The full name for virtual machine. The length of this field can be upto 64 characters. If name + is not provided, service uses a default name based on the deployment type. For SingleServer, + default name is {SID}vm. In case of HA-AvZone systems, default name will be + {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end in case of more than 1 vm per layer. + For distributed and HA-AvSet systems, default name will be {SID}{app/ascs/db}vm with an + incrementor at the end in case of more than 1 vm per layer.""" + host_name: Optional[str] = rest_field(name="hostName") + """The full name for virtual-machine's host (computer name). Currently, ACSS only supports host + names which are less than or equal to 13 characters long. If this value is not provided, vmName + will be used as host name.""" + network_interfaces: Optional[List["_models.NetworkInterfaceResourceNames"]] = rest_field(name="networkInterfaces") + """The list of network interface name objects for the selected virtual machine. Currently, only + one network interface is supported per virtual machine.""" + os_disk_name: Optional[str] = rest_field(name="osDiskName") + """The full name for OS disk attached to the VM. If this value is not provided, it will be named + by ARM as per its default naming standards (prefixed with vm name). There is only one OS disk + attached per Virtual Machine.""" + data_disk_names: Optional[Dict[str, List[str]]] = rest_field(name="dataDiskNames") + """The full resource names for virtual machine data disks. This is a dictionary containing list of + names of data disks per volume. Currently supported volumes for database layer are + ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For application and cs + layers, only 'default' volume is supported.""" + + @overload + def __init__( + self, + *, + vm_name: Optional[str] = None, + host_name: Optional[str] = None, + network_interfaces: Optional[List["_models.NetworkInterfaceResourceNames"]] = None, + os_disk_name: Optional[str] = None, + data_disk_names: Optional[Dict[str, List[str]]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WindowsConfiguration(OSConfiguration, discriminator="Windows"): + """Specifies Windows operating system settings on the virtual machine. + + + :ivar os_type: The OS Type. Required. Windows OS Type. + :vartype os_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.WINDOWS + """ + + os_type: Literal[OSType.WINDOWS] = rest_discriminator(name="osType") # type: ignore + """The OS Type. Required. Windows OS Type.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, os_type=OSType.WINDOWS, **kwargs) diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/_models_py3.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/_models_py3.py deleted file mode 100644 index 34dabf4d41bde..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/models/_models_py3.py +++ /dev/null @@ -1,4855 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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, TYPE_CHECKING, Union - -from .. import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class ApplicationServerConfiguration(_serialization.Model): - """Gets or sets the application server configuration. - - All required parameters must be populated in order to send to Azure. - - :ivar subnet_id: The subnet id. Required. - :vartype subnet_id: str - :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. - :vartype virtual_machine_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineConfiguration - :ivar instance_count: The number of app server instances. Required. - :vartype instance_count: int - """ - - _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": "int"}, - } - - def __init__( - self, - *, - subnet_id: str, - virtual_machine_configuration: "_models.VirtualMachineConfiguration", - instance_count: int, - **kwargs: Any - ) -> None: - """ - :keyword subnet_id: The subnet id. Required. - :paramtype subnet_id: str - :keyword virtual_machine_configuration: Gets or sets the virtual machine configuration. - Required. - :paramtype virtual_machine_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineConfiguration - :keyword instance_count: The number of app server instances. Required. - :paramtype instance_count: int - """ - super().__init__(**kwargs) - self.subnet_id = subnet_id - self.virtual_machine_configuration = virtual_machine_configuration - self.instance_count = instance_count - - -class ApplicationServerFullResourceNames(_serialization.Model): - """The full resource names object for application layer resources. The number of entries in this - list should be equal to the number VMs to be created for application layer. - - :ivar virtual_machines: The list of virtual machine naming details. - :vartype virtual_machines: - list[~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineResourceNames] - :ivar availability_set_name: The full name for availability set. In case name is not provided, - it will be defaulted to {SID}-App-AvSet. - :vartype availability_set_name: str - """ - - _attribute_map = { - "virtual_machines": {"key": "virtualMachines", "type": "[VirtualMachineResourceNames]"}, - "availability_set_name": {"key": "availabilitySetName", "type": "str"}, - } - - def __init__( - self, - *, - virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = None, - availability_set_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword virtual_machines: The list of virtual machine naming details. - :paramtype virtual_machines: - list[~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineResourceNames] - :keyword availability_set_name: The full name for availability set. In case name is not - provided, it will be defaulted to {SID}-App-AvSet. - :paramtype availability_set_name: str - """ - super().__init__(**kwargs) - self.virtual_machines = virtual_machines - self.availability_set_name = availability_set_name - - -class ApplicationServerVmDetails(_serialization.Model): - """The Application Server VM Details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: Defines the type of application server VM. Known values are: "Active", "Standby", - and "Unknown". - :vartype type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.ApplicationServerVirtualMachineType - :ivar virtual_machine_id: - :vartype virtual_machine_id: str - :ivar storage_details: Storage details of all the Storage Accounts attached to the App Virtual - Machine. For e.g. NFS on AFS Shared Storage. - :vartype storage_details: - list[~azure.mgmt.workloadssapvirtualinstance.models.StorageInformation] - """ - - _validation = { - "type": {"readonly": True}, - "virtual_machine_id": {"readonly": True}, - "storage_details": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, - "storage_details": {"key": "storageDetails", "type": "[StorageInformation]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.virtual_machine_id = None - self.storage_details = None - - -class CentralServerConfiguration(_serialization.Model): - """Gets or sets the central server configuration. - - All required parameters must be populated in order to send to Azure. - - :ivar subnet_id: The subnet id. Required. - :vartype subnet_id: str - :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. - :vartype virtual_machine_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineConfiguration - :ivar instance_count: The number of central server VMs. Required. - :vartype instance_count: int - """ - - _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": "int"}, - } - - def __init__( - self, - *, - subnet_id: str, - virtual_machine_configuration: "_models.VirtualMachineConfiguration", - instance_count: int, - **kwargs: Any - ) -> None: - """ - :keyword subnet_id: The subnet id. Required. - :paramtype subnet_id: str - :keyword virtual_machine_configuration: Gets or sets the virtual machine configuration. - Required. - :paramtype virtual_machine_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineConfiguration - :keyword instance_count: The number of central server VMs. Required. - :paramtype instance_count: int - """ - super().__init__(**kwargs) - self.subnet_id = subnet_id - self.virtual_machine_configuration = virtual_machine_configuration - self.instance_count = instance_count - - -class CentralServerFullResourceNames(_serialization.Model): - """The full resource names object for central server layer resources. - - :ivar virtual_machines: The list of names for all ASCS virtual machines to be deployed. The - number of entries in this list should be equal to the number VMs to be created for ASCS layer. - At maximum, there can be two virtual machines at this layer: ASCS and ERS. - :vartype virtual_machines: - list[~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineResourceNames] - :ivar availability_set_name: The full name for availability set. In case name is not provided, - it will be defaulted to {SID}-ASCS-AvSet. - :vartype availability_set_name: str - :ivar load_balancer: The resource names object for load balancer and related resources. - :vartype load_balancer: - ~azure.mgmt.workloadssapvirtualinstance.models.LoadBalancerResourceNames - """ - - _validation = { - "virtual_machines": {"max_items": 2, "min_items": 0}, - } - - _attribute_map = { - "virtual_machines": {"key": "virtualMachines", "type": "[VirtualMachineResourceNames]"}, - "availability_set_name": {"key": "availabilitySetName", "type": "str"}, - "load_balancer": {"key": "loadBalancer", "type": "LoadBalancerResourceNames"}, - } - - def __init__( - self, - *, - virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = None, - availability_set_name: Optional[str] = None, - load_balancer: Optional["_models.LoadBalancerResourceNames"] = None, - **kwargs: Any - ) -> None: - """ - :keyword virtual_machines: The list of names for all ASCS virtual machines to be deployed. The - number of entries in this list should be equal to the number VMs to be created for ASCS layer. - At maximum, there can be two virtual machines at this layer: ASCS and ERS. - :paramtype virtual_machines: - list[~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineResourceNames] - :keyword availability_set_name: The full name for availability set. In case name is not - provided, it will be defaulted to {SID}-ASCS-AvSet. - :paramtype availability_set_name: str - :keyword load_balancer: The resource names object for load balancer and related resources. - :paramtype load_balancer: - ~azure.mgmt.workloadssapvirtualinstance.models.LoadBalancerResourceNames - """ - super().__init__(**kwargs) - self.virtual_machines = virtual_machines - self.availability_set_name = availability_set_name - self.load_balancer = load_balancer - - -class CentralServerVmDetails(_serialization.Model): - """The SAP Central Services Instance 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. Known values are: "Primary", "Secondary", - "Unknown", "ASCS", "ERSInactive", "ERS", and "Standby". - :vartype type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.CentralServerVirtualMachineType - :ivar virtual_machine_id: - :vartype virtual_machine_id: str - :ivar storage_details: Storage details of all the Storage Accounts attached to the ASCS Virtual - Machine. For e.g. NFS on AFS Shared Storage. - :vartype storage_details: - list[~azure.mgmt.workloadssapvirtualinstance.models.StorageInformation] - """ - - _validation = { - "type": {"readonly": True}, - "virtual_machine_id": {"readonly": True}, - "storage_details": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, - "storage_details": {"key": "storageDetails", "type": "[StorageInformation]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.virtual_machine_id = None - self.storage_details = None - - -class FileShareConfiguration(_serialization.Model): - """File Share configuration details, populated with information on storage configuration mounted - on the VIS. The createAndMount option is selected in case of missing input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - CreateAndMountFileShareConfiguration, MountFileShareConfiguration, SkipFileShareConfiguration - - All required parameters must be populated in order to send to Azure. - - :ivar configuration_type: The type of file share config. Required. Known values are: "Skip", - "CreateAndMount", and "Mount". - :vartype configuration_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.ConfigurationType - """ - - _validation = { - "configuration_type": {"required": True}, - } - - _attribute_map = { - "configuration_type": {"key": "configurationType", "type": "str"}, - } - - _subtype_map = { - "configuration_type": { - "CreateAndMount": "CreateAndMountFileShareConfiguration", - "Mount": "MountFileShareConfiguration", - "Skip": "SkipFileShareConfiguration", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.configuration_type: Optional[str] = None - - -class CreateAndMountFileShareConfiguration(FileShareConfiguration): - """Gets or sets the file share configuration where the transport directory fileshare is created - and mounted as a part of the create infra flow. Please pre-create the resource group you intend - to place the transport directory in. The storage account and fileshare will be auto-created by - the ACSS and doesn't need to be pre-created. - - All required parameters must be populated in order to send to Azure. - - :ivar configuration_type: The type of file share config. Required. Known values are: "Skip", - "CreateAndMount", and "Mount". - :vartype configuration_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.ConfigurationType - :ivar resource_group: The name of transport file share resource group. This should be pre - created by the customer. The app rg is used in case of missing input. - :vartype resource_group: str - :ivar storage_account_name: The name of file share storage account name . A custom name is used - in case of missing input. - :vartype storage_account_name: str - """ - - _validation = { - "configuration_type": {"required": True}, - } - - _attribute_map = { - "configuration_type": {"key": "configurationType", "type": "str"}, - "resource_group": {"key": "resourceGroup", "type": "str"}, - "storage_account_name": {"key": "storageAccountName", "type": "str"}, - } - - def __init__( - self, *, resource_group: Optional[str] = None, storage_account_name: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_group: The name of transport file share resource group. This should be pre - created by the customer. The app rg is used in case of missing input. - :paramtype resource_group: str - :keyword storage_account_name: The name of file share storage account name . A custom name is - used in case of missing input. - :paramtype storage_account_name: str - """ - super().__init__(**kwargs) - self.configuration_type: str = "CreateAndMount" - self.resource_group = resource_group - self.storage_account_name = storage_account_name - - -class DatabaseConfiguration(_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. Known values are: "HANA" and "DB2". - :vartype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType - :ivar subnet_id: The subnet id. Required. - :vartype subnet_id: str - :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. - :vartype virtual_machine_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineConfiguration - :ivar instance_count: The number of database VMs. Required. - :vartype instance_count: int - :ivar disk_configuration: Gets or sets the disk configuration. - :vartype disk_configuration: ~azure.mgmt.workloadssapvirtualinstance.models.DiskConfiguration - """ - - _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": "int"}, - "disk_configuration": {"key": "diskConfiguration", "type": "DiskConfiguration"}, - } - - def __init__( - self, - *, - subnet_id: str, - virtual_machine_configuration: "_models.VirtualMachineConfiguration", - instance_count: int, - database_type: Optional[Union[str, "_models.SAPDatabaseType"]] = None, - disk_configuration: Optional["_models.DiskConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword database_type: The database type. Known values are: "HANA" and "DB2". - :paramtype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType - :keyword subnet_id: The subnet id. Required. - :paramtype subnet_id: str - :keyword virtual_machine_configuration: Gets or sets the virtual machine configuration. - Required. - :paramtype virtual_machine_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineConfiguration - :keyword instance_count: The number of database VMs. Required. - :paramtype instance_count: int - :keyword disk_configuration: Gets or sets the disk configuration. - :paramtype disk_configuration: ~azure.mgmt.workloadssapvirtualinstance.models.DiskConfiguration - """ - super().__init__(**kwargs) - self.database_type = database_type - self.subnet_id = subnet_id - self.virtual_machine_configuration = virtual_machine_configuration - self.instance_count = instance_count - self.disk_configuration = disk_configuration - - -class DatabaseServerFullResourceNames(_serialization.Model): - """The full resource names object for database layer resources. The number of entries in this list - should be equal to the number VMs to be created for database layer. - - :ivar virtual_machines: The list of virtual machine naming details. - :vartype virtual_machines: - list[~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineResourceNames] - :ivar availability_set_name: The full name for availability set. In case name is not provided, - it will be defaulted to {SID}-DB-AvSet. - :vartype availability_set_name: str - :ivar load_balancer: The resource names object for load balancer and related resources. - :vartype load_balancer: - ~azure.mgmt.workloadssapvirtualinstance.models.LoadBalancerResourceNames - """ - - _validation = { - "virtual_machines": {"max_items": 2, "min_items": 0}, - } - - _attribute_map = { - "virtual_machines": {"key": "virtualMachines", "type": "[VirtualMachineResourceNames]"}, - "availability_set_name": {"key": "availabilitySetName", "type": "str"}, - "load_balancer": {"key": "loadBalancer", "type": "LoadBalancerResourceNames"}, - } - - def __init__( - self, - *, - virtual_machines: Optional[List["_models.VirtualMachineResourceNames"]] = None, - availability_set_name: Optional[str] = None, - load_balancer: Optional["_models.LoadBalancerResourceNames"] = None, - **kwargs: Any - ) -> None: - """ - :keyword virtual_machines: The list of virtual machine naming details. - :paramtype virtual_machines: - list[~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineResourceNames] - :keyword availability_set_name: The full name for availability set. In case name is not - provided, it will be defaulted to {SID}-DB-AvSet. - :paramtype availability_set_name: str - :keyword load_balancer: The resource names object for load balancer and related resources. - :paramtype load_balancer: - ~azure.mgmt.workloadssapvirtualinstance.models.LoadBalancerResourceNames - """ - super().__init__(**kwargs) - self.virtual_machines = virtual_machines - self.availability_set_name = availability_set_name - self.load_balancer = load_balancer - - -class DatabaseVmDetails(_serialization.Model): - """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. Known values are: "Starting", "Running", - "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". - :vartype status: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceStatus - :ivar storage_details: Storage details of all the Storage Accounts attached to the Database - Virtual Machine. For e.g. NFS on AFS Shared Storage. - :vartype storage_details: - list[~azure.mgmt.workloadssapvirtualinstance.models.StorageInformation] - """ - - _validation = { - "virtual_machine_id": {"readonly": True}, - "status": {"readonly": True}, - "storage_details": {"readonly": True}, - } - - _attribute_map = { - "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "storage_details": {"key": "storageDetails", "type": "[StorageInformation]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.virtual_machine_id = None - self.status = None - self.storage_details = None - - -class DeployerVmPackages(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.url = url - self.storage_account_id = storage_account_id - - -class SAPConfiguration(_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: The configuration Type. Required. Known values are: "Deployment", - "Discovery", and "DeploymentWithOSConfig". - :vartype configuration_type: str or - ~azure.mgmt.workloadssapvirtualinstance.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.configuration_type: Optional[str] = None - - -class DeploymentConfiguration(SAPConfiguration): - """Deployment Configuration. - - All required parameters must be populated in order to send to Azure. - - :ivar configuration_type: The configuration Type. Required. Known values are: "Deployment", - "Discovery", and "DeploymentWithOSConfig". - :vartype configuration_type: str or - ~azure.mgmt.workloadssapvirtualinstance.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.workloadssapvirtualinstance.models.InfrastructureConfiguration - :ivar software_configuration: The software configuration. - :vartype software_configuration: - ~azure.mgmt.workloadssapvirtualinstance.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["_models.InfrastructureConfiguration"] = None, - software_configuration: Optional["_models.SoftwareConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :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.workloadssapvirtualinstance.models.InfrastructureConfiguration - :keyword software_configuration: The software configuration. - :paramtype software_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.SoftwareConfiguration - """ - super().__init__(**kwargs) - self.configuration_type: str = "Deployment" - 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: The configuration Type. Required. Known values are: "Deployment", - "Discovery", and "DeploymentWithOSConfig". - :vartype configuration_type: str or - ~azure.mgmt.workloadssapvirtualinstance.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.workloadssapvirtualinstance.models.InfrastructureConfiguration - :ivar software_configuration: The software configuration. - :vartype software_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.SoftwareConfiguration - :ivar os_sap_configuration: The OS and SAP configuration. - :vartype os_sap_configuration: - ~azure.mgmt.workloadssapvirtualinstance.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["_models.InfrastructureConfiguration"] = None, - software_configuration: Optional["_models.SoftwareConfiguration"] = None, - os_sap_configuration: Optional["_models.OsSapConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :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.workloadssapvirtualinstance.models.InfrastructureConfiguration - :keyword software_configuration: The software configuration. - :paramtype software_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.SoftwareConfiguration - :keyword os_sap_configuration: The OS and SAP configuration. - :paramtype os_sap_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.OsSapConfiguration - """ - super().__init__(**kwargs) - self.configuration_type: str = "DeploymentWithOSConfig" - 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: The configuration Type. Required. Known values are: "Deployment", - "Discovery", and "DeploymentWithOSConfig". - :vartype configuration_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPConfigurationType - :ivar central_server_vm_id: The virtual machine ID of the Central Server. - :vartype central_server_vm_id: str - :ivar managed_rg_storage_account_name: The custom storage account name for the storage account - created by the service in the managed resource group created as part of VIS - deployment.:code:`
`:code:`
`Refer to the storage account naming rules `here - `_.:code:`
`:code:`
`If - not provided, the service will create the storage account with a random name. - :vartype managed_rg_storage_account_name: str - :ivar app_location: The geo-location where the SAP system exists. - :vartype app_location: str - """ - - _validation = { - "configuration_type": {"required": True}, - "managed_rg_storage_account_name": {"max_length": 24, "min_length": 3}, - "app_location": {"readonly": True}, - } - - _attribute_map = { - "configuration_type": {"key": "configurationType", "type": "str"}, - "central_server_vm_id": {"key": "centralServerVmId", "type": "str"}, - "managed_rg_storage_account_name": {"key": "managedRgStorageAccountName", "type": "str"}, - "app_location": {"key": "appLocation", "type": "str"}, - } - - def __init__( - self, - *, - central_server_vm_id: Optional[str] = None, - managed_rg_storage_account_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword central_server_vm_id: The virtual machine ID of the Central Server. - :paramtype central_server_vm_id: str - :keyword managed_rg_storage_account_name: The custom storage account name for the storage - account created by the service in the managed resource group created as part of VIS - deployment.:code:`
`:code:`
`Refer to the storage account naming rules `here - `_.:code:`
`:code:`
`If - not provided, the service will create the storage account with a random name. - :paramtype managed_rg_storage_account_name: str - """ - super().__init__(**kwargs) - self.configuration_type: str = "Discovery" - self.central_server_vm_id = central_server_vm_id - self.managed_rg_storage_account_name = managed_rg_storage_account_name - self.app_location = None - - -class DiskConfiguration(_serialization.Model): - """The Disk Configuration Details. - - :ivar disk_volume_configurations: The disk configuration for the db volume. For HANA, Required - volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : - ['backup']. - :vartype disk_volume_configurations: dict[str, - ~azure.mgmt.workloadssapvirtualinstance.models.DiskVolumeConfiguration] - """ - - _attribute_map = { - "disk_volume_configurations": {"key": "diskVolumeConfigurations", "type": "{DiskVolumeConfiguration}"}, - } - - def __init__( - self, - *, - disk_volume_configurations: Optional[Dict[str, "_models.DiskVolumeConfiguration"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword disk_volume_configurations: The disk configuration for the db volume. For HANA, - Required volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume - : ['backup']. - :paramtype disk_volume_configurations: dict[str, - ~azure.mgmt.workloadssapvirtualinstance.models.DiskVolumeConfiguration] - """ - super().__init__(**kwargs) - self.disk_volume_configurations = disk_volume_configurations - - -class DiskDetails(_serialization.Model): - """The supported disk size details for a disk type. - - :ivar sku: The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, - Premium_ZRS. - :vartype sku: ~azure.mgmt.workloadssapvirtualinstance.models.DiskSku - :ivar size_gb: The disk size in GB. - :vartype size_gb: int - :ivar minimum_supported_disk_count: The minimum supported disk count. - :vartype minimum_supported_disk_count: int - :ivar maximum_supported_disk_count: The maximum supported disk count. - :vartype maximum_supported_disk_count: int - :ivar iops_read_write: The disk Iops. - :vartype iops_read_write: int - :ivar mbps_read_write: The disk provisioned throughput in MBps. - :vartype mbps_read_write: int - :ivar disk_tier: The disk tier, e.g. P10, E10. - :vartype disk_tier: str - """ - - _attribute_map = { - "sku": {"key": "sku", "type": "DiskSku"}, - "size_gb": {"key": "sizeGB", "type": "int"}, - "minimum_supported_disk_count": {"key": "minimumSupportedDiskCount", "type": "int"}, - "maximum_supported_disk_count": {"key": "maximumSupportedDiskCount", "type": "int"}, - "iops_read_write": {"key": "iopsReadWrite", "type": "int"}, - "mbps_read_write": {"key": "mbpsReadWrite", "type": "int"}, - "disk_tier": {"key": "diskTier", "type": "str"}, - } - - def __init__( - self, - *, - sku: Optional["_models.DiskSku"] = None, - size_gb: Optional[int] = None, - minimum_supported_disk_count: Optional[int] = None, - maximum_supported_disk_count: Optional[int] = None, - iops_read_write: Optional[int] = None, - mbps_read_write: Optional[int] = None, - disk_tier: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword sku: The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, - Premium_ZRS. - :paramtype sku: ~azure.mgmt.workloadssapvirtualinstance.models.DiskSku - :keyword size_gb: The disk size in GB. - :paramtype size_gb: int - :keyword minimum_supported_disk_count: The minimum supported disk count. - :paramtype minimum_supported_disk_count: int - :keyword maximum_supported_disk_count: The maximum supported disk count. - :paramtype maximum_supported_disk_count: int - :keyword iops_read_write: The disk Iops. - :paramtype iops_read_write: int - :keyword mbps_read_write: The disk provisioned throughput in MBps. - :paramtype mbps_read_write: int - :keyword disk_tier: The disk tier, e.g. P10, E10. - :paramtype disk_tier: str - """ - super().__init__(**kwargs) - self.sku = sku - self.size_gb = size_gb - self.minimum_supported_disk_count = minimum_supported_disk_count - self.maximum_supported_disk_count = maximum_supported_disk_count - self.iops_read_write = iops_read_write - self.mbps_read_write = mbps_read_write - self.disk_tier = disk_tier - - -class DiskSku(_serialization.Model): - """The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, Premium_ZRS. - - :ivar name: Defines the disk sku name. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS", and "PremiumV2_LRS". - :vartype name: str or ~azure.mgmt.workloadssapvirtualinstance.models.DiskSkuName - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[Union[str, "_models.DiskSkuName"]] = None, **kwargs: Any) -> None: - """ - :keyword name: Defines the disk sku name. Known values are: "Standard_LRS", "Premium_LRS", - "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", "StandardSSD_ZRS", and "PremiumV2_LRS". - :paramtype name: str or ~azure.mgmt.workloadssapvirtualinstance.models.DiskSkuName - """ - super().__init__(**kwargs) - self.name = name - - -class DiskVolumeConfiguration(_serialization.Model): - """The disk configuration required for the selected volume. - - :ivar count: The total number of disks required for the concerned volume. - :vartype count: int - :ivar size_gb: The disk size in GB. - :vartype size_gb: int - :ivar sku: The disk SKU details. - :vartype sku: ~azure.mgmt.workloadssapvirtualinstance.models.DiskSku - """ - - _attribute_map = { - "count": {"key": "count", "type": "int"}, - "size_gb": {"key": "sizeGB", "type": "int"}, - "sku": {"key": "sku", "type": "DiskSku"}, - } - - def __init__( - self, - *, - count: Optional[int] = None, - size_gb: Optional[int] = None, - sku: Optional["_models.DiskSku"] = None, - **kwargs: Any - ) -> None: - """ - :keyword count: The total number of disks required for the concerned volume. - :paramtype count: int - :keyword size_gb: The disk size in GB. - :paramtype size_gb: int - :keyword sku: The disk SKU details. - :paramtype sku: ~azure.mgmt.workloadssapvirtualinstance.models.DiskSku - """ - super().__init__(**kwargs) - self.count = count - self.size_gb = size_gb - self.sku = sku - - -class EnqueueReplicationServerProperties(_serialization.Model): - """Defines the SAP Enqueue Replication Server (ERS) 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. Known values are: - "EnqueueReplicator1" and "EnqueueReplicator2". - :vartype ers_version: str or - ~azure.mgmt.workloadssapvirtualinstance.models.EnqueueReplicationServerType - :ivar instance_no: ERS Instance Number. - :vartype instance_no: str - :ivar hostname: ERS SAP Hostname. - :vartype hostname: str - :ivar kernel_version: ERS SAP Kernel Version. - :vartype kernel_version: str - :ivar kernel_patch: ERS SAP Kernel Patch level. - :vartype kernel_patch: str - :ivar ip_address: ERS SAP IP Address. - :vartype ip_address: str - :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", - "Unhealthy", and "Degraded". - :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.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: Any) -> None: - """ """ - super().__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(_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: Enqueue Server SAP Hostname. - :vartype hostname: str - :ivar ip_address: Enqueue Server SAP IP Address. - :vartype ip_address: str - :ivar port: Enqueue Server Port. - :vartype port: int - :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", - "Unhealthy", and "Degraded". - :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.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": "int"}, - "health": {"key": "health", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.hostname = None - self.ip_address = None - self.port = None - self.health = None - - -class ErrorAdditionalInfo(_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: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDefinition(_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.workloadssapvirtualinstance.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.details = None - - -class ErrorDetail(_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.workloadssapvirtualinstance.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.workloadssapvirtualinstance.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_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.workloadssapvirtualinstance.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.workloadssapvirtualinstance.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class SoftwareConfiguration(_serialization.Model): - """The SAP Software configuration Input. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ExternalInstallationSoftwareConfiguration, SAPInstallWithoutOSConfigSoftwareConfiguration, - ServiceInitiatedSoftwareConfiguration - - All required parameters must be populated in order to send to Azure. - - :ivar software_installation_type: The SAP software installation Type. Required. Known values - are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External". - :vartype software_installation_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPSoftwareInstallationType - """ - - _validation = { - "software_installation_type": {"required": True}, - } - - _attribute_map = { - "software_installation_type": {"key": "softwareInstallationType", "type": "str"}, - } - - _subtype_map = { - "software_installation_type": { - "External": "ExternalInstallationSoftwareConfiguration", - "SAPInstallWithoutOSConfig": "SAPInstallWithoutOSConfigSoftwareConfiguration", - "ServiceInitiated": "ServiceInitiatedSoftwareConfiguration", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.software_installation_type: Optional[str] = None - - -class ExternalInstallationSoftwareConfiguration(SoftwareConfiguration): - """The SAP Software configuration Input when the software is installed externally outside the - service. - - All required parameters must be populated in order to send to Azure. - - :ivar software_installation_type: The SAP software installation Type. Required. Known values - are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External". - :vartype software_installation_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPSoftwareInstallationType - :ivar central_server_vm_id: The resource ID of the virtual machine containing the central - server instance. - :vartype central_server_vm_id: str - """ - - _validation = { - "software_installation_type": {"required": True}, - } - - _attribute_map = { - "software_installation_type": {"key": "softwareInstallationType", "type": "str"}, - "central_server_vm_id": {"key": "centralServerVmId", "type": "str"}, - } - - def __init__(self, *, central_server_vm_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword central_server_vm_id: The resource ID of the virtual machine containing the central - server instance. - :paramtype central_server_vm_id: str - """ - super().__init__(**kwargs) - self.software_installation_type: str = "External" - self.central_server_vm_id = central_server_vm_id - - -class GatewayServerProperties(_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: Gateway Port. - :vartype port: int - :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", - "Unhealthy", and "Degraded". - :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPHealthState - """ - - _validation = { - "port": {"readonly": True}, - "health": {"readonly": True}, - } - - _attribute_map = { - "port": {"key": "port", "type": "int"}, - "health": {"key": "health", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.port = None - self.health = None - - -class HighAvailabilityConfiguration(_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: The high availability type. Required. Known values are: - "AvailabilitySet" and "AvailabilityZone". - :vartype high_availability_type: str or - ~azure.mgmt.workloadssapvirtualinstance.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, "_models.SAPHighAvailabilityType"], **kwargs: Any) -> None: - """ - :keyword high_availability_type: The high availability type. Required. Known values are: - "AvailabilitySet" and "AvailabilityZone". - :paramtype high_availability_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPHighAvailabilityType - """ - super().__init__(**kwargs) - self.high_availability_type = high_availability_type - - -class HighAvailabilitySoftwareConfiguration(_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: The fencing client id. Required. - :vartype fencing_client_id: str - :ivar fencing_client_password: The fencing client id secret/password. The secret should never - expire. This will be used pacemaker to start/stop the cluster VMs. Required. - :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: Any) -> None: - """ - :keyword fencing_client_id: The fencing client id. Required. - :paramtype fencing_client_id: str - :keyword fencing_client_password: The fencing client id secret/password. The secret should - never expire. This will be used pacemaker to start/stop the cluster VMs. Required. - :paramtype fencing_client_password: str - """ - super().__init__(**kwargs) - self.fencing_client_id = fencing_client_id - self.fencing_client_password = fencing_client_password - - -class ImageReference(_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. - - :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 id: Specifies the ARM resource ID of the Azure Compute Gallery image version used for - creating ACSS VMs. You will need to provide this input when you choose to deploy virtual - machines in ACSS with OS image from the Azure Compute gallery. - :vartype id: str - """ - - _attribute_map = { - "publisher": {"key": "publisher", "type": "str"}, - "offer": {"key": "offer", "type": "str"}, - "sku": {"key": "sku", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "id": {"key": "id", "type": "str"}, - } - - def __init__( - self, - *, - publisher: Optional[str] = None, - offer: Optional[str] = None, - sku: Optional[str] = None, - version: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs: Any - ) -> None: - """ - :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 id: Specifies the ARM resource ID of the Azure Compute Gallery image version used for - creating ACSS VMs. You will need to provide this input when you choose to deploy virtual - machines in ACSS with OS image from the Azure Compute gallery. - :paramtype id: str - """ - super().__init__(**kwargs) - self.publisher = publisher - self.offer = offer - self.sku = sku - self.version = version - self.id = id - - -class InfrastructureConfiguration(_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: The type of SAP deployment, single server or Three tier. Required. Known - values are: "SingleServer" and "ThreeTier". - :vartype deployment_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType - :ivar app_resource_group: The application resource group where SAP system resources will be - deployed. Required. - :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: Any) -> None: - """ - :keyword app_resource_group: The application resource group where SAP system resources will be - deployed. Required. - :paramtype app_resource_group: str - """ - super().__init__(**kwargs) - self.deployment_type: Optional[str] = None - self.app_resource_group = app_resource_group - - -class OSConfiguration(_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: The OS Type. Required. Known values are: "Linux" and "Windows". - :vartype os_type: str or ~azure.mgmt.workloadssapvirtualinstance.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.os_type: Optional[str] = None - - -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: The OS Type. Required. Known values are: "Linux" and "Windows". - :vartype os_type: str or ~azure.mgmt.workloadssapvirtualinstance.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.workloadssapvirtualinstance.models.SshConfiguration - :ivar ssh_key_pair: The SSH Key-pair used to authenticate with the VM's. - :vartype ssh_key_pair: ~azure.mgmt.workloadssapvirtualinstance.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["_models.SshConfiguration"] = None, - ssh_key_pair: Optional["_models.SshKeyPair"] = None, - **kwargs: Any - ) -> None: - """ - :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.workloadssapvirtualinstance.models.SshConfiguration - :keyword ssh_key_pair: The SSH Key-pair used to authenticate with the VM's. - :paramtype ssh_key_pair: ~azure.mgmt.workloadssapvirtualinstance.models.SshKeyPair - """ - super().__init__(**kwargs) - self.os_type: str = "Linux" - self.disable_password_authentication = disable_password_authentication - self.ssh = ssh - self.ssh_key_pair = ssh_key_pair - - -class LoadBalancerDetails(_serialization.Model): - """The Load Balancer details such as Load Balancer ID. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: - :vartype id: str - """ - - _validation = { - "id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - - -class LoadBalancerResourceNames(_serialization.Model): - """The resource names object for load balancer and related resources. - - :ivar load_balancer_name: The full resource name for load balancer. If this value is not - provided, load balancer will be name as {ASCS/DB}-loadBalancer. - :vartype load_balancer_name: str - :ivar frontend_ip_configuration_names: The list of frontend IP configuration names. If provided - as input, size of this list should be 2 for cs layer and should be 1 for database layer. - :vartype frontend_ip_configuration_names: list[str] - :ivar backend_pool_names: The list of backend pool names. Currently, ACSS deploys only one - backend pool and hence, size of this list should be 1. - :vartype backend_pool_names: list[str] - :ivar health_probe_names: The list of health probe names. If provided as input, size of this - list should be 2 for cs layer and should be 1 for database layer. - :vartype health_probe_names: list[str] - """ - - _validation = { - "frontend_ip_configuration_names": {"max_items": 2, "min_items": 0}, - "backend_pool_names": {"max_items": 1, "min_items": 0}, - "health_probe_names": {"max_items": 2, "min_items": 0}, - } - - _attribute_map = { - "load_balancer_name": {"key": "loadBalancerName", "type": "str"}, - "frontend_ip_configuration_names": {"key": "frontendIpConfigurationNames", "type": "[str]"}, - "backend_pool_names": {"key": "backendPoolNames", "type": "[str]"}, - "health_probe_names": {"key": "healthProbeNames", "type": "[str]"}, - } - - def __init__( - self, - *, - load_balancer_name: Optional[str] = None, - frontend_ip_configuration_names: Optional[List[str]] = None, - backend_pool_names: Optional[List[str]] = None, - health_probe_names: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword load_balancer_name: The full resource name for load balancer. If this value is not - provided, load balancer will be name as {ASCS/DB}-loadBalancer. - :paramtype load_balancer_name: str - :keyword frontend_ip_configuration_names: The list of frontend IP configuration names. If - provided as input, size of this list should be 2 for cs layer and should be 1 for database - layer. - :paramtype frontend_ip_configuration_names: list[str] - :keyword backend_pool_names: The list of backend pool names. Currently, ACSS deploys only one - backend pool and hence, size of this list should be 1. - :paramtype backend_pool_names: list[str] - :keyword health_probe_names: The list of health probe names. If provided as input, size of this - list should be 2 for cs layer and should be 1 for database layer. - :paramtype health_probe_names: list[str] - """ - super().__init__(**kwargs) - self.load_balancer_name = load_balancer_name - self.frontend_ip_configuration_names = frontend_ip_configuration_names - self.backend_pool_names = backend_pool_names - self.health_probe_names = health_probe_names - - -class ManagedRGConfiguration(_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: Any) -> None: - """ - :keyword name: Managed resource group name. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class MessageServerProperties(_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: message server port. - :vartype ms_port: int - :ivar internal_ms_port: message server internal MS port. - :vartype internal_ms_port: int - :ivar http_port: message server HTTP Port. - :vartype http_port: int - :ivar https_port: message server HTTPS Port. - :vartype https_port: int - :ivar hostname: message server SAP Hostname. - :vartype hostname: str - :ivar ip_address: message server IP Address. - :vartype ip_address: str - :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", - "Unhealthy", and "Degraded". - :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.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": "int"}, - "internal_ms_port": {"key": "internalMsPort", "type": "int"}, - "http_port": {"key": "httpPort", "type": "int"}, - "https_port": {"key": "httpsPort", "type": "int"}, - "hostname": {"key": "hostname", "type": "str"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "health": {"key": "health", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__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 MountFileShareConfiguration(FileShareConfiguration): - """Gets or sets the file share configuration where the transport directory fileshare already - exists, and user wishes to mount the fileshare as a part of the create infra flow. - - All required parameters must be populated in order to send to Azure. - - :ivar configuration_type: The type of file share config. Required. Known values are: "Skip", - "CreateAndMount", and "Mount". - :vartype configuration_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.ConfigurationType - :ivar id: The fileshare resource ID. Required. - :vartype id: str - :ivar private_endpoint_id: The private endpoint resource ID. Required. - :vartype private_endpoint_id: str - """ - - _validation = { - "configuration_type": {"required": True}, - "id": {"required": True}, - "private_endpoint_id": {"required": True}, - } - - _attribute_map = { - "configuration_type": {"key": "configurationType", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "private_endpoint_id": {"key": "privateEndpointId", "type": "str"}, - } - - def __init__( - self, *, id: str, private_endpoint_id: str, **kwargs: Any # pylint: disable=redefined-builtin - ) -> None: - """ - :keyword id: The fileshare resource ID. Required. - :paramtype id: str - :keyword private_endpoint_id: The private endpoint resource ID. Required. - :paramtype private_endpoint_id: str - """ - super().__init__(**kwargs) - self.configuration_type: str = "Mount" - self.id = id - self.private_endpoint_id = private_endpoint_id - - -class NetworkConfiguration(_serialization.Model): - """Defines the network configuration type for SAP system infrastructure that is being deployed. - - :ivar is_secondary_ip_enabled: Specifies whether a secondary IP address should be added to the - network interface on all VMs of the SAP system being deployed. - :vartype is_secondary_ip_enabled: bool - """ - - _attribute_map = { - "is_secondary_ip_enabled": {"key": "isSecondaryIpEnabled", "type": "bool"}, - } - - def __init__(self, *, is_secondary_ip_enabled: bool = False, **kwargs: Any) -> None: - """ - :keyword is_secondary_ip_enabled: Specifies whether a secondary IP address should be added to - the network interface on all VMs of the SAP system being deployed. - :paramtype is_secondary_ip_enabled: bool - """ - super().__init__(**kwargs) - self.is_secondary_ip_enabled = is_secondary_ip_enabled - - -class NetworkInterfaceResourceNames(_serialization.Model): - """The resource names object for network interface and related resources. - - :ivar network_interface_name: The full name for network interface. If name is not provided, - service uses a default name based on the deployment type. For SingleServer, default name is - {SID}-Nic. In case of HA-AvZone systems, default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic - with an incrementor at the end in case of more than 1 instance per layer. For distributed and - HA-AvSet systems, default name will be {SID}-{App/ASCS/DB}-Nic with an incrementor at the end - in case of more than 1 instance per layer. - :vartype network_interface_name: str - """ - - _attribute_map = { - "network_interface_name": {"key": "networkInterfaceName", "type": "str"}, - } - - def __init__(self, *, network_interface_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword network_interface_name: The full name for network interface. If name is not provided, - service uses a default name based on the deployment type. For SingleServer, default name is - {SID}-Nic. In case of HA-AvZone systems, default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic - with an incrementor at the end in case of more than 1 instance per layer. For distributed and - HA-AvSet systems, default name will be {SID}-{App/ASCS/DB}-Nic with an incrementor at the end - in case of more than 1 instance per layer. - :paramtype network_interface_name: str - """ - super().__init__(**kwargs) - self.network_interface_name = network_interface_name - - -class Operation(_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.workloadssapvirtualinstance.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". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.workloadssapvirtualinstance.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.workloadssapvirtualinstance.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["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.workloadssapvirtualinstance.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - - -class OperationDisplay(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(_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.workloadssapvirtualinstance.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class OperationStatusResult(_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: Operation status. Required. - :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.workloadssapvirtualinstance.models.OperationStatusResult] - :ivar error: If present, details of the operation error. - :vartype error: ~azure.mgmt.workloadssapvirtualinstance.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, # pylint: disable=redefined-builtin - name: Optional[str] = None, - percent_complete: Optional[float] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - operations: Optional[List["_models.OperationStatusResult"]] = None, - error: Optional["_models.ErrorDetail"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Fully qualified ID for the async operation. - :paramtype id: str - :keyword name: Name of the async operation. - :paramtype name: str - :keyword status: Operation status. Required. - :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.workloadssapvirtualinstance.models.OperationStatusResult] - :keyword error: If present, details of the operation error. - :paramtype error: ~azure.mgmt.workloadssapvirtualinstance.models.ErrorDetail - """ - super().__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 OSProfile(_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.workloadssapvirtualinstance.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["_models.OSConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :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.workloadssapvirtualinstance.models.OSConfiguration - """ - super().__init__(**kwargs) - self.admin_username = admin_username - self.admin_password = admin_password - self.os_configuration = os_configuration - - -class OsSapConfiguration(_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.workloadssapvirtualinstance.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["_models.DeployerVmPackages"] = None, - sap_fqdn: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword deployer_vm_packages: The url and storage account ID where deployer VM packages are - uploaded. - :paramtype deployer_vm_packages: - ~azure.mgmt.workloadssapvirtualinstance.models.DeployerVmPackages - :keyword sap_fqdn: The FQDN to set for the SAP system. - :paramtype sap_fqdn: str - """ - super().__init__(**kwargs) - self.deployer_vm_packages = deployer_vm_packages - self.sap_fqdn = sap_fqdn - - -class Resource(_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.workloadssapvirtualinstance.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: Any) -> None: - """ """ - super().__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.workloadssapvirtualinstance.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "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: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class SAPApplicationServerInstance(TrackedResource): - """Define the SAP Application Server Instance 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.workloadssapvirtualinstance.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: Defines the SAP Application Server instance properties. - :vartype properties: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerProperties - """ - - _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"}, - "properties": {"key": "properties", "type": "SAPApplicationServerProperties"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.SAPApplicationServerProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword properties: Defines the SAP Application Server instance properties. - :paramtype properties: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerProperties - """ - super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - - -class SAPApplicationServerInstanceList(_serialization.Model): - """Defines the collection of SAP Application Server Instance resources. - - :ivar value: Gets the list of SAP Application Server instance resources. - :vartype value: - list[~azure.mgmt.workloadssapvirtualinstance.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["_models.SAPApplicationServerInstance"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets the list of SAP Application Server instance resources. - :paramtype value: - list[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] - :keyword next_link: Gets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SAPApplicationServerProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Defines the SAP Application Server instance properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar instance_no: Application server Instance Number. - :vartype instance_no: str - :ivar subnet: Application server Subnet. - :vartype subnet: str - :ivar hostname: Application server instance SAP hostname. - :vartype hostname: str - :ivar kernel_version: Application server instance SAP Kernel Version. - :vartype kernel_version: str - :ivar kernel_patch: Application server instance SAP Kernel Patch level. - :vartype kernel_patch: str - :ivar ip_address: Application server instance SAP IP Address. - :vartype ip_address: str - :ivar gateway_port: Application server instance gateway Port. - :vartype gateway_port: int - :ivar icm_http_port: Application server instance ICM HTTP Port. - :vartype icm_http_port: int - :ivar icm_https_port: Application server instance ICM HTTPS Port. - :vartype icm_https_port: int - :ivar dispatcher_status: Application server instance dispatcher status. - :vartype dispatcher_status: str - :ivar load_balancer_details: The Load Balancer details such as LoadBalancer ID attached to - Application Server Virtual Machines. - :vartype load_balancer_details: - ~azure.mgmt.workloadssapvirtualinstance.models.LoadBalancerDetails - :ivar vm_details: The list of virtual machines. - :vartype vm_details: - list[~azure.mgmt.workloadssapvirtualinstance.models.ApplicationServerVmDetails] - :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", - "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". - :vartype status: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceStatus - :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", - "Unhealthy", and "Degraded". - :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPHealthState - :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", - "Updating", "Creating", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SapVirtualInstanceProvisioningState - :ivar errors: Defines the Application Instance errors. - :vartype errors: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceError - """ - - _validation = { - "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}, - "dispatcher_status": {"readonly": True}, - "load_balancer_details": {"readonly": True}, - "vm_details": {"readonly": True}, - "status": {"readonly": True}, - "health": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "errors": {"readonly": True}, - } - - _attribute_map = { - "instance_no": {"key": "instanceNo", "type": "str"}, - "subnet": {"key": "subnet", "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"}, - "gateway_port": {"key": "gatewayPort", "type": "int"}, - "icm_http_port": {"key": "icmHttpPort", "type": "int"}, - "icm_https_port": {"key": "icmHttpsPort", "type": "int"}, - "dispatcher_status": {"key": "dispatcherStatus", "type": "str"}, - "load_balancer_details": {"key": "loadBalancerDetails", "type": "LoadBalancerDetails"}, - "vm_details": {"key": "vmDetails", "type": "[ApplicationServerVmDetails]"}, - "status": {"key": "status", "type": "str"}, - "health": {"key": "health", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "errors": {"key": "errors", "type": "SAPVirtualInstanceError"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**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.dispatcher_status = None - self.load_balancer_details = None - self.vm_details = None - self.status = None - self.health = None - self.provisioning_state = None - self.errors = None - - -class SAPAvailabilityZoneDetailsRequest(_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: The geo-location where the SAP resources will be created. Required. - :vartype app_location: str - :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", - and "Other". - :vartype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType - :ivar database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: "HANA" - and "DB2". - :vartype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.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, "_models.SAPProductType"], - database_type: Union[str, "_models.SAPDatabaseType"], - **kwargs: Any - ) -> None: - """ - :keyword app_location: The geo-location where the SAP resources will be created. Required. - :paramtype app_location: str - :keyword sap_product: Defines the SAP Product type. Required. Known values are: "ECC", - "S4HANA", and "Other". - :paramtype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType - :keyword database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: - "HANA" and "DB2". - :paramtype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType - """ - super().__init__(**kwargs) - self.app_location = app_location - self.sap_product = sap_product - self.database_type = database_type - - -class SAPAvailabilityZoneDetailsResult(_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.workloadssapvirtualinstance.models.SAPAvailabilityZonePair] - """ - - _attribute_map = { - "availability_zone_pairs": {"key": "availabilityZonePairs", "type": "[SAPAvailabilityZonePair]"}, - } - - def __init__( - self, *, availability_zone_pairs: Optional[List["_models.SAPAvailabilityZonePair"]] = None, **kwargs: Any - ) -> None: - """ - :keyword availability_zone_pairs: Gets the list of availability zone pairs. - :paramtype availability_zone_pairs: - list[~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZonePair] - """ - super().__init__(**kwargs) - self.availability_zone_pairs = availability_zone_pairs - - -class SAPAvailabilityZonePair(_serialization.Model): - """The SAP Availability Zone Pair. - - :ivar zone_a: The zone A. - :vartype zone_a: int - :ivar zone_b: The zone B. - :vartype zone_b: int - """ - - _attribute_map = { - "zone_a": {"key": "zoneA", "type": "int"}, - "zone_b": {"key": "zoneB", "type": "int"}, - } - - def __init__(self, *, zone_a: Optional[int] = None, zone_b: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword zone_a: The zone A. - :paramtype zone_a: int - :keyword zone_b: The zone B. - :paramtype zone_b: int - """ - super().__init__(**kwargs) - self.zone_a = zone_a - self.zone_b = zone_b - - -class SAPCentralInstanceList(_serialization.Model): - """Defines the collection of SAP Central Services Instance resources. - - :ivar value: Gets the list of SAP central services instance resources. - :vartype value: list[~azure.mgmt.workloadssapvirtualinstance.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["_models.SAPCentralServerInstance"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets the list of SAP central services instance resources. - :paramtype value: list[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] - :keyword next_link: Gets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SAPCentralServerInstance(TrackedResource): - """Define the SAP Central Services Instance 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.workloadssapvirtualinstance.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: Defines the SAP Central Services Instance properties. - :vartype properties: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerProperties - """ - - _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"}, - "properties": {"key": "properties", "type": "SAPCentralServerProperties"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.SAPCentralServerProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword properties: Defines the SAP Central Services Instance properties. - :paramtype properties: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerProperties - """ - super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - - -class SAPCentralServerProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Defines the SAP Central Services Instance properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar instance_no: The central services instance number. - :vartype instance_no: str - :ivar subnet: The central services instance subnet. - :vartype subnet: str - :ivar message_server_properties: Defines the SAP message server properties. - :vartype message_server_properties: - ~azure.mgmt.workloadssapvirtualinstance.models.MessageServerProperties - :ivar enqueue_server_properties: Defines the SAP Enqueue Server properties. - :vartype enqueue_server_properties: - ~azure.mgmt.workloadssapvirtualinstance.models.EnqueueServerProperties - :ivar gateway_server_properties: Defines the SAP Gateway Server properties. - :vartype gateway_server_properties: - ~azure.mgmt.workloadssapvirtualinstance.models.GatewayServerProperties - :ivar enqueue_replication_server_properties: Defines the SAP Enqueue Replication Server (ERS) - properties. - :vartype enqueue_replication_server_properties: - ~azure.mgmt.workloadssapvirtualinstance.models.EnqueueReplicationServerProperties - :ivar kernel_version: The central services instance Kernel Version. - :vartype kernel_version: str - :ivar kernel_patch: The central services instance Kernel Patch level. - :vartype kernel_patch: str - :ivar load_balancer_details: The Load Balancer details such as LoadBalancer ID attached to ASCS - Virtual Machines. - :vartype load_balancer_details: - ~azure.mgmt.workloadssapvirtualinstance.models.LoadBalancerDetails - :ivar vm_details: The list of virtual machines corresponding to the Central Services instance. - :vartype vm_details: - list[~azure.mgmt.workloadssapvirtualinstance.models.CentralServerVmDetails] - :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", - "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". - :vartype status: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceStatus - :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", - "Unhealthy", and "Degraded". - :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPHealthState - :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", - "Updating", "Creating", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SapVirtualInstanceProvisioningState - :ivar errors: Defines the errors related to SAP Central Services Instance resource. - :vartype errors: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceError - """ - - _validation = { - "instance_no": {"readonly": True}, - "subnet": {"readonly": True}, - "kernel_version": {"readonly": True}, - "kernel_patch": {"readonly": True}, - "load_balancer_details": {"readonly": True}, - "vm_details": {"readonly": True}, - "status": {"readonly": True}, - "health": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "errors": {"readonly": True}, - } - - _attribute_map = { - "instance_no": {"key": "instanceNo", "type": "str"}, - "subnet": {"key": "subnet", "type": "str"}, - "message_server_properties": {"key": "messageServerProperties", "type": "MessageServerProperties"}, - "enqueue_server_properties": {"key": "enqueueServerProperties", "type": "EnqueueServerProperties"}, - "gateway_server_properties": {"key": "gatewayServerProperties", "type": "GatewayServerProperties"}, - "enqueue_replication_server_properties": { - "key": "enqueueReplicationServerProperties", - "type": "EnqueueReplicationServerProperties", - }, - "kernel_version": {"key": "kernelVersion", "type": "str"}, - "kernel_patch": {"key": "kernelPatch", "type": "str"}, - "load_balancer_details": {"key": "loadBalancerDetails", "type": "LoadBalancerDetails"}, - "vm_details": {"key": "vmDetails", "type": "[CentralServerVmDetails]"}, - "status": {"key": "status", "type": "str"}, - "health": {"key": "health", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "errors": {"key": "errors", "type": "SAPVirtualInstanceError"}, - } - - def __init__( - self, - *, - message_server_properties: Optional["_models.MessageServerProperties"] = None, - enqueue_server_properties: Optional["_models.EnqueueServerProperties"] = None, - gateway_server_properties: Optional["_models.GatewayServerProperties"] = None, - enqueue_replication_server_properties: Optional["_models.EnqueueReplicationServerProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword message_server_properties: Defines the SAP message server properties. - :paramtype message_server_properties: - ~azure.mgmt.workloadssapvirtualinstance.models.MessageServerProperties - :keyword enqueue_server_properties: Defines the SAP Enqueue Server properties. - :paramtype enqueue_server_properties: - ~azure.mgmt.workloadssapvirtualinstance.models.EnqueueServerProperties - :keyword gateway_server_properties: Defines the SAP Gateway Server properties. - :paramtype gateway_server_properties: - ~azure.mgmt.workloadssapvirtualinstance.models.GatewayServerProperties - :keyword enqueue_replication_server_properties: Defines the SAP Enqueue Replication Server - (ERS) properties. - :paramtype enqueue_replication_server_properties: - ~azure.mgmt.workloadssapvirtualinstance.models.EnqueueReplicationServerProperties - """ - super().__init__(**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.load_balancer_details = None - self.vm_details = None - self.status = None - self.health = None - self.provisioning_state = None - self.errors = None - - -class SAPDatabaseInstance(TrackedResource): - """Define the Database 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.workloadssapvirtualinstance.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: Defines the Database properties. - :vartype properties: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseProperties - """ - - _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"}, - "properties": {"key": "properties", "type": "SAPDatabaseProperties"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.SAPDatabaseProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword properties: Defines the Database properties. - :paramtype properties: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseProperties - """ - super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - - -class SAPDatabaseInstanceList(_serialization.Model): - """Defines the collection of SAP Database Instances. - - :ivar value: Gets the list of SAP Database instances. - :vartype value: list[~azure.mgmt.workloadssapvirtualinstance.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["_models.SAPDatabaseInstance"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets the list of SAP Database instances. - :paramtype value: list[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] - :keyword next_link: Gets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SAPDatabaseProperties(_serialization.Model): - """Defines the Database properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar subnet: Database subnet. - :vartype subnet: str - :ivar database_sid: Database SID name. - :vartype database_sid: str - :ivar database_type: Database type, that is if the DB is HANA, DB2, Oracle, SAP ASE, Max DB or - MS SQL Server. - :vartype database_type: str - :ivar ip_address: Database IP Address. - :vartype ip_address: str - :ivar load_balancer_details: The Load Balancer details such as LoadBalancer ID attached to - Database Virtual Machines. - :vartype load_balancer_details: - ~azure.mgmt.workloadssapvirtualinstance.models.LoadBalancerDetails - :ivar vm_details: The list of virtual machines corresponding to the Database resource. - :vartype vm_details: list[~azure.mgmt.workloadssapvirtualinstance.models.DatabaseVmDetails] - :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", - "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". - :vartype status: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceStatus - :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", - "Updating", "Creating", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SapVirtualInstanceProvisioningState - :ivar errors: Defines the errors related to Database resource. - :vartype errors: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceError - """ - - _validation = { - "subnet": {"readonly": True}, - "database_sid": {"readonly": True}, - "database_type": {"readonly": True}, - "ip_address": {"readonly": True}, - "load_balancer_details": {"readonly": True}, - "vm_details": {"readonly": True}, - "status": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "errors": {"readonly": True}, - } - - _attribute_map = { - "subnet": {"key": "subnet", "type": "str"}, - "database_sid": {"key": "databaseSid", "type": "str"}, - "database_type": {"key": "databaseType", "type": "str"}, - "ip_address": {"key": "ipAddress", "type": "str"}, - "load_balancer_details": {"key": "loadBalancerDetails", "type": "LoadBalancerDetails"}, - "vm_details": {"key": "vmDetails", "type": "[DatabaseVmDetails]"}, - "status": {"key": "status", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "errors": {"key": "errors", "type": "SAPVirtualInstanceError"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.subnet = None - self.database_sid = None - self.database_type = None - self.ip_address = None - self.load_balancer_details = None - self.vm_details = None - self.status = None - self.provisioning_state = None - self.errors = None - - -class SAPDiskConfiguration(_serialization.Model): - """The SAP Disk Configuration contains 'recommended disk' details and list of supported disks - detail for a volume type. - - :ivar recommended_configuration: The recommended disk details for a given VM Sku. - :vartype recommended_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.DiskVolumeConfiguration - :ivar supported_configurations: The list of supported disks for a given VM Sku. - :vartype supported_configurations: - list[~azure.mgmt.workloadssapvirtualinstance.models.DiskDetails] - """ - - _attribute_map = { - "recommended_configuration": {"key": "recommendedConfiguration", "type": "DiskVolumeConfiguration"}, - "supported_configurations": {"key": "supportedConfigurations", "type": "[DiskDetails]"}, - } - - def __init__( - self, - *, - recommended_configuration: Optional["_models.DiskVolumeConfiguration"] = None, - supported_configurations: Optional[List["_models.DiskDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword recommended_configuration: The recommended disk details for a given VM Sku. - :paramtype recommended_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.DiskVolumeConfiguration - :keyword supported_configurations: The list of supported disks for a given VM Sku. - :paramtype supported_configurations: - list[~azure.mgmt.workloadssapvirtualinstance.models.DiskDetails] - """ - super().__init__(**kwargs) - self.recommended_configuration = recommended_configuration - self.supported_configurations = supported_configurations - - -class SAPDiskConfigurationsRequest(_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: The geo-location where the SAP resources will be created. Required. - :vartype app_location: str - :ivar environment: Defines the environment type - Production/Non Production. Required. Known - values are: "NonProd" and "Prod". - :vartype environment: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPEnvironmentType - :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", - and "Other". - :vartype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType - :ivar database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: "HANA" - and "DB2". - :vartype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType - :ivar deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known values - are: "SingleServer" and "ThreeTier". - :vartype deployment_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType - :ivar db_vm_sku: The VM SKU for database instance. Required. - :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, "_models.SAPEnvironmentType"], - sap_product: Union[str, "_models.SAPProductType"], - database_type: Union[str, "_models.SAPDatabaseType"], - deployment_type: Union[str, "_models.SAPDeploymentType"], - db_vm_sku: str, - **kwargs: Any - ) -> None: - """ - :keyword app_location: The geo-location where the SAP resources will be created. Required. - :paramtype app_location: str - :keyword environment: Defines the environment type - Production/Non Production. Required. Known - values are: "NonProd" and "Prod". - :paramtype environment: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPEnvironmentType - :keyword sap_product: Defines the SAP Product type. Required. Known values are: "ECC", - "S4HANA", and "Other". - :paramtype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType - :keyword database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: - "HANA" and "DB2". - :paramtype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType - :keyword deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known - values are: "SingleServer" and "ThreeTier". - :paramtype deployment_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType - :keyword db_vm_sku: The VM SKU for database instance. Required. - :paramtype db_vm_sku: str - """ - super().__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(_serialization.Model): - """The list of disk configuration for vmSku which are part of SAP deployment. - - :ivar volume_configurations: The disk configuration for the db volume. For HANA, Required - volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : - ['backup']. - :vartype volume_configurations: dict[str, - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfiguration] - """ - - _attribute_map = { - "volume_configurations": {"key": "volumeConfigurations", "type": "{SAPDiskConfiguration}"}, - } - - def __init__( - self, *, volume_configurations: Optional[Dict[str, "_models.SAPDiskConfiguration"]] = None, **kwargs: Any - ) -> None: - """ - :keyword volume_configurations: The disk configuration for the db volume. For HANA, Required - volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : - ['backup']. - :paramtype volume_configurations: dict[str, - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfiguration] - """ - super().__init__(**kwargs) - self.volume_configurations = volume_configurations - - -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: The SAP software installation Type. Required. Known values - are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External". - :vartype software_installation_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPSoftwareInstallationType - :ivar bom_url: The URL to the SAP Build of Materials(BOM) file. Required. - :vartype bom_url: str - :ivar sap_bits_storage_account_id: The SAP bits storage account id. Required. - :vartype sap_bits_storage_account_id: str - :ivar software_version: The software version to install. Required. - :vartype software_version: str - :ivar high_availability_software_configuration: Gets or sets the HA software configuration. - :vartype high_availability_software_configuration: - ~azure.mgmt.workloadssapvirtualinstance.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["_models.HighAvailabilitySoftwareConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword bom_url: The URL to the SAP Build of Materials(BOM) file. Required. - :paramtype bom_url: str - :keyword sap_bits_storage_account_id: The SAP bits storage account id. Required. - :paramtype sap_bits_storage_account_id: str - :keyword software_version: The software version to install. Required. - :paramtype software_version: str - :keyword high_availability_software_configuration: Gets or sets the HA software configuration. - :paramtype high_availability_software_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.HighAvailabilitySoftwareConfiguration - """ - super().__init__(**kwargs) - self.software_installation_type: str = "SAPInstallWithoutOSConfig" - 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 SAPSizingRecommendationRequest(_serialization.Model): - """The SAP Sizing Recommendation request. - - All required parameters must be populated in order to send to Azure. - - :ivar app_location: The geo-location where the resource is to be created. Required. - :vartype app_location: str - :ivar environment: Defines the environment type - Production/Non Production. Required. Known - values are: "NonProd" and "Prod". - :vartype environment: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPEnvironmentType - :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", - and "Other". - :vartype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType - :ivar deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known values - are: "SingleServer" and "ThreeTier". - :vartype deployment_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType - :ivar saps: The SAP Application Performance Standard measurement. Required. - :vartype saps: int - :ivar db_memory: The database memory configuration. Required. - :vartype db_memory: int - :ivar database_type: The database type. Required. Known values are: "HANA" and "DB2". - :vartype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType - :ivar db_scale_method: The DB scale method. "ScaleUp" - :vartype db_scale_method: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseScaleMethod - :ivar high_availability_type: The high availability type. Known values are: "AvailabilitySet" - and "AvailabilityZone". - :vartype high_availability_type: str or - ~azure.mgmt.workloadssapvirtualinstance.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": "int"}, - "db_memory": {"key": "dbMemory", "type": "int"}, - "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, "_models.SAPEnvironmentType"], - sap_product: Union[str, "_models.SAPProductType"], - deployment_type: Union[str, "_models.SAPDeploymentType"], - saps: int, - db_memory: int, - database_type: Union[str, "_models.SAPDatabaseType"], - db_scale_method: Optional[Union[str, "_models.SAPDatabaseScaleMethod"]] = None, - high_availability_type: Optional[Union[str, "_models.SAPHighAvailabilityType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_location: The geo-location where the resource is to be created. Required. - :paramtype app_location: str - :keyword environment: Defines the environment type - Production/Non Production. Required. Known - values are: "NonProd" and "Prod". - :paramtype environment: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPEnvironmentType - :keyword sap_product: Defines the SAP Product type. Required. Known values are: "ECC", - "S4HANA", and "Other". - :paramtype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType - :keyword deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known - values are: "SingleServer" and "ThreeTier". - :paramtype deployment_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType - :keyword saps: The SAP Application Performance Standard measurement. Required. - :paramtype saps: int - :keyword db_memory: The database memory configuration. Required. - :paramtype db_memory: int - :keyword database_type: The database type. Required. Known values are: "HANA" and "DB2". - :paramtype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType - :keyword db_scale_method: The DB scale method. "ScaleUp" - :paramtype db_scale_method: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseScaleMethod - :keyword high_availability_type: The high availability type. Known values are: - "AvailabilitySet" and "AvailabilityZone". - :paramtype high_availability_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPHighAvailabilityType - """ - super().__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(_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: The type of SAP deployment, single server or Three tier. Required. Known - values are: "SingleServer" and "ThreeTier". - :vartype deployment_type: str or - ~azure.mgmt.workloadssapvirtualinstance.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.deployment_type: Optional[str] = None - - -class SAPSupportedResourceSkusResult(_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.workloadssapvirtualinstance.models.SAPSupportedSku] - """ - - _attribute_map = { - "supported_skus": {"key": "supportedSkus", "type": "[SAPSupportedSku]"}, - } - - def __init__(self, *, supported_skus: Optional[List["_models.SAPSupportedSku"]] = None, **kwargs: Any) -> None: - """ - :keyword supported_skus: Gets the list of SAP supported SKUs. - :paramtype supported_skus: list[~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedSku] - """ - super().__init__(**kwargs) - self.supported_skus = supported_skus - - -class SAPSupportedSku(_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: Any - ) -> None: - """ - :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().__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(_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: The geo-location where the resource is to be created. Required. - :vartype app_location: str - :ivar environment: Defines the environment type - Production/Non Production. Required. Known - values are: "NonProd" and "Prod". - :vartype environment: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPEnvironmentType - :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", - and "Other". - :vartype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType - :ivar deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known values - are: "SingleServer" and "ThreeTier". - :vartype deployment_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType - :ivar database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: "HANA" - and "DB2". - :vartype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType - :ivar high_availability_type: The high availability type. Known values are: "AvailabilitySet" - and "AvailabilityZone". - :vartype high_availability_type: str or - ~azure.mgmt.workloadssapvirtualinstance.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, "_models.SAPEnvironmentType"], - sap_product: Union[str, "_models.SAPProductType"], - deployment_type: Union[str, "_models.SAPDeploymentType"], - database_type: Union[str, "_models.SAPDatabaseType"], - high_availability_type: Optional[Union[str, "_models.SAPHighAvailabilityType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_location: The geo-location where the resource is to be created. Required. - :paramtype app_location: str - :keyword environment: Defines the environment type - Production/Non Production. Required. Known - values are: "NonProd" and "Prod". - :paramtype environment: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPEnvironmentType - :keyword sap_product: Defines the SAP Product type. Required. Known values are: "ECC", - "S4HANA", and "Other". - :paramtype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType - :keyword deployment_type: The deployment type. Eg: SingleServer/ThreeTier. Required. Known - values are: "SingleServer" and "ThreeTier". - :paramtype deployment_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType - :keyword database_type: The database type. Eg: HANA, DB2, etc. Required. Known values are: - "HANA" and "DB2". - :paramtype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType - :keyword high_availability_type: The high availability type. Known values are: - "AvailabilitySet" and "AvailabilityZone". - :paramtype high_availability_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPHighAvailabilityType - """ - super().__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 solutions 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.workloadssapvirtualinstance.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: Managed service identity (user assigned identities). - :vartype identity: ~azure.mgmt.workloadssapvirtualinstance.models.UserAssignedServiceIdentity - :ivar properties: Defines the Virtual Instance for SAP solutions resource properties. Required. - :vartype properties: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "properties": {"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"}, - "identity": {"key": "identity", "type": "UserAssignedServiceIdentity"}, - "properties": {"key": "properties", "type": "SAPVirtualInstanceProperties"}, - } - - def __init__( - self, - *, - location: str, - properties: "_models.SAPVirtualInstanceProperties", - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.UserAssignedServiceIdentity"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Managed service identity (user assigned identities). - :paramtype identity: ~azure.mgmt.workloadssapvirtualinstance.models.UserAssignedServiceIdentity - :keyword properties: Defines the Virtual Instance for SAP solutions resource properties. - Required. - :paramtype properties: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceProperties - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.properties = properties - - -class SAPVirtualInstanceError(_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.workloadssapvirtualinstance.models.ErrorDefinition - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "ErrorDefinition"}, - } - - def __init__(self, *, properties: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The Virtual Instance for SAP error body. - :paramtype properties: ~azure.mgmt.workloadssapvirtualinstance.models.ErrorDefinition - """ - super().__init__(**kwargs) - self.properties = properties - - -class SAPVirtualInstanceList(_serialization.Model): - """Defines the collection of Virtual Instance for SAP solutions resources. - - :ivar value: Gets the list of Virtual Instances for SAP solutions resources. - :vartype value: list[~azure.mgmt.workloadssapvirtualinstance.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["_models.SAPVirtualInstance"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Gets the list of Virtual Instances for SAP solutions resources. - :paramtype value: list[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :keyword next_link: Gets the value of next link. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SAPVirtualInstanceProperties(_serialization.Model): - """Defines the Virtual Instance for SAP solutions resource 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 environment: Defines the environment type - Production/Non Production. Required. Known - values are: "NonProd" and "Prod". - :vartype environment: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPEnvironmentType - :ivar sap_product: Defines the SAP Product type. Required. Known values are: "ECC", "S4HANA", - and "Other". - :vartype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType - :ivar managed_resources_network_access_type: Specifies the network access configuration for the - resources that will be deployed in the Managed Resource Group. The options to choose from are - Public and Private. If 'Private' is chosen, the Storage Account service tag should be enabled - on the subnets in which the SAP VMs exist. This is required for establishing connectivity - between VM extensions and the managed resource group storage account. This setting is currently - applicable only to Storage Account. Learn more here - https://go.microsoft.com/fwlink/?linkid=2247228. Known values are: "Public" and "Private". - :vartype managed_resources_network_access_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.ManagedResourcesNetworkAccessType - :ivar configuration: Defines if the SAP system is being created using Azure Center for SAP - solutions (ACSS) or if an existing SAP system is being registered with ACSS. Required. - :vartype configuration: ~azure.mgmt.workloadssapvirtualinstance.models.SAPConfiguration - :ivar managed_resource_group_configuration: Managed resource group configuration. - :vartype managed_resource_group_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.ManagedRGConfiguration - :ivar status: Defines the SAP Instance status. Known values are: "Starting", "Running", - "Stopping", "Offline", "PartiallyRunning", "Unavailable", and "SoftShutdown". - :vartype status: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceStatus - :ivar health: Defines the health of SAP Instances. Known values are: "Unknown", "Healthy", - "Unhealthy", and "Degraded". - :vartype health: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPHealthState - :ivar state: Defines the Virtual Instance for SAP state. Known values are: - "InfrastructureDeploymentPending", "InfrastructureDeploymentInProgress", - "InfrastructureDeploymentFailed", "SoftwareInstallationPending", - "SoftwareInstallationInProgress", "SoftwareInstallationFailed", "SoftwareDetectionInProgress", - "SoftwareDetectionFailed", "DiscoveryPending", "DiscoveryInProgress", "DiscoveryFailed", - "RegistrationComplete", and "ACSSInstallationBlocked". - :vartype state: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceState - :ivar provisioning_state: Defines the provisioning states. Known values are: "Succeeded", - "Updating", "Creating", "Failed", "Deleting", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SapVirtualInstanceProvisioningState - :ivar errors: Indicates any errors on the Virtual Instance for SAP solutions resource. - :vartype errors: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstanceError - """ - - _validation = { - "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 = { - "environment": {"key": "environment", "type": "str"}, - "sap_product": {"key": "sapProduct", "type": "str"}, - "managed_resources_network_access_type": {"key": "managedResourcesNetworkAccessType", "type": "str"}, - "configuration": {"key": "configuration", "type": "SAPConfiguration"}, - "managed_resource_group_configuration": { - "key": "managedResourceGroupConfiguration", - "type": "ManagedRGConfiguration", - }, - "status": {"key": "status", "type": "str"}, - "health": {"key": "health", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "errors": {"key": "errors", "type": "SAPVirtualInstanceError"}, - } - - def __init__( - self, - *, - environment: Union[str, "_models.SAPEnvironmentType"], - sap_product: Union[str, "_models.SAPProductType"], - configuration: "_models.SAPConfiguration", - managed_resources_network_access_type: Optional[Union[str, "_models.ManagedResourcesNetworkAccessType"]] = None, - managed_resource_group_configuration: Optional["_models.ManagedRGConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword environment: Defines the environment type - Production/Non Production. Required. Known - values are: "NonProd" and "Prod". - :paramtype environment: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPEnvironmentType - :keyword sap_product: Defines the SAP Product type. Required. Known values are: "ECC", - "S4HANA", and "Other". - :paramtype sap_product: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPProductType - :keyword managed_resources_network_access_type: Specifies the network access configuration for - the resources that will be deployed in the Managed Resource Group. The options to choose from - are Public and Private. If 'Private' is chosen, the Storage Account service tag should be - enabled on the subnets in which the SAP VMs exist. This is required for establishing - connectivity between VM extensions and the managed resource group storage account. This setting - is currently applicable only to Storage Account. Learn more here - https://go.microsoft.com/fwlink/?linkid=2247228. Known values are: "Public" and "Private". - :paramtype managed_resources_network_access_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.ManagedResourcesNetworkAccessType - :keyword configuration: Defines if the SAP system is being created using Azure Center for SAP - solutions (ACSS) or if an existing SAP system is being registered with ACSS. Required. - :paramtype configuration: ~azure.mgmt.workloadssapvirtualinstance.models.SAPConfiguration - :keyword managed_resource_group_configuration: Managed resource group configuration. - :paramtype managed_resource_group_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.ManagedRGConfiguration - """ - super().__init__(**kwargs) - self.environment = environment - self.sap_product = sap_product - self.managed_resources_network_access_type = managed_resources_network_access_type - 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 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: The SAP software installation Type. Required. Known values - are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External". - :vartype software_installation_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPSoftwareInstallationType - :ivar bom_url: The URL to the SAP Build of Materials(BOM) file. Required. - :vartype bom_url: str - :ivar software_version: The software version to install. Required. - :vartype software_version: str - :ivar sap_bits_storage_account_id: The SAP bits storage account id. Required. - :vartype sap_bits_storage_account_id: str - :ivar sap_fqdn: The FQDN to set for the SAP system during install. Required. - :vartype sap_fqdn: str - :ivar ssh_private_key: The SSH private key. Required. - :vartype ssh_private_key: str - :ivar high_availability_software_configuration: Gets or sets the HA software configuration. - :vartype high_availability_software_configuration: - ~azure.mgmt.workloadssapvirtualinstance.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["_models.HighAvailabilitySoftwareConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword bom_url: The URL to the SAP Build of Materials(BOM) file. Required. - :paramtype bom_url: str - :keyword software_version: The software version to install. Required. - :paramtype software_version: str - :keyword sap_bits_storage_account_id: The SAP bits storage account id. Required. - :paramtype sap_bits_storage_account_id: str - :keyword sap_fqdn: The FQDN to set for the SAP system during install. Required. - :paramtype sap_fqdn: str - :keyword ssh_private_key: The SSH private key. Required. - :paramtype ssh_private_key: str - :keyword high_availability_software_configuration: Gets or sets the HA software configuration. - :paramtype high_availability_software_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.HighAvailabilitySoftwareConfiguration - """ - super().__init__(**kwargs) - self.software_installation_type: str = "ServiceInitiated" - 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 SharedStorageResourceNames(_serialization.Model): - """The resource names object for shared storage. - - :ivar shared_storage_account_name: The full name of the shared storage account. If it is not - provided, it will be defaulted to {SID}nfs{guid of 15 chars}. - :vartype shared_storage_account_name: str - :ivar shared_storage_account_private_end_point_name: The full name of private end point for the - shared storage account. If it is not provided, it will be defaulted to {storageAccountName}_pe. - :vartype shared_storage_account_private_end_point_name: str - """ - - _attribute_map = { - "shared_storage_account_name": {"key": "sharedStorageAccountName", "type": "str"}, - "shared_storage_account_private_end_point_name": { - "key": "sharedStorageAccountPrivateEndPointName", - "type": "str", - }, - } - - def __init__( - self, - *, - shared_storage_account_name: Optional[str] = None, - shared_storage_account_private_end_point_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword shared_storage_account_name: The full name of the shared storage account. If it is not - provided, it will be defaulted to {SID}nfs{guid of 15 chars}. - :paramtype shared_storage_account_name: str - :keyword shared_storage_account_private_end_point_name: The full name of private end point for - the shared storage account. If it is not provided, it will be defaulted to - {storageAccountName}_pe. - :paramtype shared_storage_account_private_end_point_name: str - """ - super().__init__(**kwargs) - self.shared_storage_account_name = shared_storage_account_name - self.shared_storage_account_private_end_point_name = shared_storage_account_private_end_point_name - - -class SingleServerConfiguration(InfrastructureConfiguration): - """Gets or sets the single server configuration. For prerequisites for creating the - infrastructure, please see `here - `_. - - All required parameters must be populated in order to send to Azure. - - :ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known - values are: "SingleServer" and "ThreeTier". - :vartype deployment_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType - :ivar app_resource_group: The application resource group where SAP system resources will be - deployed. Required. - :vartype app_resource_group: str - :ivar network_configuration: Network configuration for the server. - :vartype network_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.NetworkConfiguration - :ivar database_type: The database type. Known values are: "HANA" and "DB2". - :vartype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType - :ivar subnet_id: The subnet id. Required. - :vartype subnet_id: str - :ivar virtual_machine_configuration: Gets or sets the virtual machine configuration. Required. - :vartype virtual_machine_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineConfiguration - :ivar db_disk_configuration: Gets or sets the disk configuration. - :vartype db_disk_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.DiskConfiguration - :ivar custom_resource_names: The set of custom names to be used for underlying azure resources - that are part of the SAP system. - :vartype custom_resource_names: - ~azure.mgmt.workloadssapvirtualinstance.models.SingleServerCustomResourceNames - """ - - _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"}, - "db_disk_configuration": {"key": "dbDiskConfiguration", "type": "DiskConfiguration"}, - "custom_resource_names": {"key": "customResourceNames", "type": "SingleServerCustomResourceNames"}, - } - - def __init__( - self, - *, - app_resource_group: str, - subnet_id: str, - virtual_machine_configuration: "_models.VirtualMachineConfiguration", - network_configuration: Optional["_models.NetworkConfiguration"] = None, - database_type: Optional[Union[str, "_models.SAPDatabaseType"]] = None, - db_disk_configuration: Optional["_models.DiskConfiguration"] = None, - custom_resource_names: Optional["_models.SingleServerCustomResourceNames"] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_group: The application resource group where SAP system resources will be - deployed. Required. - :paramtype app_resource_group: str - :keyword network_configuration: Network configuration for the server. - :paramtype network_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.NetworkConfiguration - :keyword database_type: The database type. Known values are: "HANA" and "DB2". - :paramtype database_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseType - :keyword subnet_id: The subnet id. Required. - :paramtype subnet_id: str - :keyword virtual_machine_configuration: Gets or sets the virtual machine configuration. - Required. - :paramtype virtual_machine_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineConfiguration - :keyword db_disk_configuration: Gets or sets the disk configuration. - :paramtype db_disk_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.DiskConfiguration - :keyword custom_resource_names: The set of custom names to be used for underlying azure - resources that are part of the SAP system. - :paramtype custom_resource_names: - ~azure.mgmt.workloadssapvirtualinstance.models.SingleServerCustomResourceNames - """ - super().__init__(app_resource_group=app_resource_group, **kwargs) - self.deployment_type: str = "SingleServer" - self.network_configuration = network_configuration - self.database_type = database_type - self.subnet_id = subnet_id - self.virtual_machine_configuration = virtual_machine_configuration - self.db_disk_configuration = db_disk_configuration - self.custom_resource_names = custom_resource_names - - -class SingleServerCustomResourceNames(_serialization.Model): - """The resource-names input to specify custom names for underlying azure resources that are part - of a single server SAP system. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - SingleServerFullResourceNames - - All required parameters must be populated in order to send to Azure. - - :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. - "FullResourceName" - :vartype naming_pattern_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.NamingPatternType - """ - - _validation = { - "naming_pattern_type": {"required": True}, - } - - _attribute_map = { - "naming_pattern_type": {"key": "namingPatternType", "type": "str"}, - } - - _subtype_map = {"naming_pattern_type": {"FullResourceName": "SingleServerFullResourceNames"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.naming_pattern_type: Optional[str] = None - - -class SingleServerFullResourceNames(SingleServerCustomResourceNames): - """The resource name object where the specified values will be full resource names of the - corresponding resources in a single server SAP system. - - All required parameters must be populated in order to send to Azure. - - :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. - "FullResourceName" - :vartype naming_pattern_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.NamingPatternType - :ivar virtual_machine: The resource names object for virtual machine and related resources. - :vartype virtual_machine: - ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineResourceNames - """ - - _validation = { - "naming_pattern_type": {"required": True}, - } - - _attribute_map = { - "naming_pattern_type": {"key": "namingPatternType", "type": "str"}, - "virtual_machine": {"key": "virtualMachine", "type": "VirtualMachineResourceNames"}, - } - - def __init__( - self, *, virtual_machine: Optional["_models.VirtualMachineResourceNames"] = None, **kwargs: Any - ) -> None: - """ - :keyword virtual_machine: The resource names object for virtual machine and related resources. - :paramtype virtual_machine: - ~azure.mgmt.workloadssapvirtualinstance.models.VirtualMachineResourceNames - """ - super().__init__(**kwargs) - self.naming_pattern_type: str = "FullResourceName" - self.virtual_machine = virtual_machine - - -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: The type of SAP deployment, single server or Three tier. Required. Known - values are: "SingleServer" and "ThreeTier". - :vartype deployment_type: str or - ~azure.mgmt.workloadssapvirtualinstance.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: Any) -> None: - """ - :keyword vm_sku: The recommended VM SKU for single server. - :paramtype vm_sku: str - """ - super().__init__(**kwargs) - self.deployment_type: str = "SingleServer" - self.vm_sku = vm_sku - - -class SkipFileShareConfiguration(FileShareConfiguration): - """Gets or sets the file share configuration for scenarios where transport directory fileshare is - not created or required. - - All required parameters must be populated in order to send to Azure. - - :ivar configuration_type: The type of file share config. Required. Known values are: "Skip", - "CreateAndMount", and "Mount". - :vartype configuration_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.ConfigurationType - """ - - _validation = { - "configuration_type": {"required": True}, - } - - _attribute_map = { - "configuration_type": {"key": "configurationType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.configuration_type: str = "Skip" - - -class SshConfiguration(_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.workloadssapvirtualinstance.models.SshPublicKey] - """ - - _attribute_map = { - "public_keys": {"key": "publicKeys", "type": "[SshPublicKey]"}, - } - - def __init__(self, *, public_keys: Optional[List["_models.SshPublicKey"]] = None, **kwargs: Any) -> None: - """ - :keyword public_keys: The list of SSH public keys used to authenticate with linux based VMs. - :paramtype public_keys: list[~azure.mgmt.workloadssapvirtualinstance.models.SshPublicKey] - """ - super().__init__(**kwargs) - self.public_keys = public_keys - - -class SshKeyPair(_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: Any) -> None: - """ - :keyword public_key: SSH public key. - :paramtype public_key: str - :keyword private_key: SSH private key. - :paramtype private_key: str - """ - super().__init__(**kwargs) - self.public_key = public_key - self.private_key = private_key - - -class SshPublicKey(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.key_data = key_data - - -class StartRequest(_serialization.Model): - """Start SAP instance(s) request body. - - :ivar start_vm: The boolean value indicates whether to start the virtual machines before - starting the SAP instances. - :vartype start_vm: bool - """ - - _attribute_map = { - "start_vm": {"key": "startVm", "type": "bool"}, - } - - def __init__(self, *, start_vm: bool = False, **kwargs: Any) -> None: - """ - :keyword start_vm: The boolean value indicates whether to start the virtual machines before - starting the SAP instances. - :paramtype start_vm: bool - """ - super().__init__(**kwargs) - self.start_vm = start_vm - - -class StopRequest(_serialization.Model): - """Stop SAP instance(s) request body. - - :ivar soft_stop_timeout_seconds: This parameter defines how long (in seconds) the soft shutdown - waits until the RFC/HTTP clients no longer consider the server for calls with load balancing. - Value 0 means that the kernel does not wait, but goes directly into the next shutdown state, - i.e. hard stop. - :vartype soft_stop_timeout_seconds: int - :ivar deallocate_vm: The boolean value indicates whether to Stop and deallocate the virtual - machines along with the SAP instances. - :vartype deallocate_vm: bool - """ - - _attribute_map = { - "soft_stop_timeout_seconds": {"key": "softStopTimeoutSeconds", "type": "int"}, - "deallocate_vm": {"key": "deallocateVm", "type": "bool"}, - } - - def __init__(self, *, soft_stop_timeout_seconds: int = 0, deallocate_vm: bool = False, **kwargs: Any) -> None: - """ - :keyword soft_stop_timeout_seconds: This parameter defines how long (in seconds) the soft - shutdown waits until the RFC/HTTP clients no longer consider the server for calls with load - balancing. Value 0 means that the kernel does not wait, but goes directly into the next - shutdown state, i.e. hard stop. - :paramtype soft_stop_timeout_seconds: int - :keyword deallocate_vm: The boolean value indicates whether to Stop and deallocate the virtual - machines along with the SAP instances. - :paramtype deallocate_vm: bool - """ - super().__init__(**kwargs) - self.soft_stop_timeout_seconds = soft_stop_timeout_seconds - self.deallocate_vm = deallocate_vm - - -class StorageConfiguration(_serialization.Model): - """Gets or sets the storage configuration. - - :ivar transport_file_share_configuration: The properties of the transport directory attached to - the VIS. The default for transportFileShareConfiguration is the createAndMount flow if storage - configuration is missing. - :vartype transport_file_share_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.FileShareConfiguration - """ - - _attribute_map = { - "transport_file_share_configuration": { - "key": "transportFileShareConfiguration", - "type": "FileShareConfiguration", - }, - } - - def __init__( - self, *, transport_file_share_configuration: Optional["_models.FileShareConfiguration"] = None, **kwargs: Any - ) -> None: - """ - :keyword transport_file_share_configuration: The properties of the transport directory attached - to the VIS. The default for transportFileShareConfiguration is the createAndMount flow if - storage configuration is missing. - :paramtype transport_file_share_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.FileShareConfiguration - """ - super().__init__(**kwargs) - self.transport_file_share_configuration = transport_file_share_configuration - - -class StorageInformation(_serialization.Model): - """Storage details of all the Storage accounts attached to the VM. For e.g. NFS on AFS Shared - Storage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: - :vartype id: str - """ - - _validation = { - "id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - - -class SystemData(_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. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.workloadssapvirtualinstance.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, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 ThreeTierConfiguration(InfrastructureConfiguration): - """Gets or sets the three tier SAP configuration. For prerequisites for creating the - infrastructure, please see `here - `_. - - All required parameters must be populated in order to send to Azure. - - :ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known - values are: "SingleServer" and "ThreeTier". - :vartype deployment_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDeploymentType - :ivar app_resource_group: The application resource group where SAP system resources will be - deployed. Required. - :vartype app_resource_group: str - :ivar network_configuration: Network configuration common to all servers. - :vartype network_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.NetworkConfiguration - :ivar central_server: The central server configuration. Required. - :vartype central_server: - ~azure.mgmt.workloadssapvirtualinstance.models.CentralServerConfiguration - :ivar application_server: The application server configuration. Required. - :vartype application_server: - ~azure.mgmt.workloadssapvirtualinstance.models.ApplicationServerConfiguration - :ivar database_server: The database configuration. Required. - :vartype database_server: ~azure.mgmt.workloadssapvirtualinstance.models.DatabaseConfiguration - :ivar high_availability_config: The high availability configuration. - :vartype high_availability_config: - ~azure.mgmt.workloadssapvirtualinstance.models.HighAvailabilityConfiguration - :ivar storage_configuration: The storage configuration. - :vartype storage_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.StorageConfiguration - :ivar custom_resource_names: The set of custom names to be used for underlying azure resources - that are part of the SAP system. - :vartype custom_resource_names: - ~azure.mgmt.workloadssapvirtualinstance.models.ThreeTierCustomResourceNames - """ - - _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"}, - "storage_configuration": {"key": "storageConfiguration", "type": "StorageConfiguration"}, - "custom_resource_names": {"key": "customResourceNames", "type": "ThreeTierCustomResourceNames"}, - } - - def __init__( - self, - *, - app_resource_group: str, - central_server: "_models.CentralServerConfiguration", - application_server: "_models.ApplicationServerConfiguration", - database_server: "_models.DatabaseConfiguration", - network_configuration: Optional["_models.NetworkConfiguration"] = None, - high_availability_config: Optional["_models.HighAvailabilityConfiguration"] = None, - storage_configuration: Optional["_models.StorageConfiguration"] = None, - custom_resource_names: Optional["_models.ThreeTierCustomResourceNames"] = None, - **kwargs: Any - ) -> None: - """ - :keyword app_resource_group: The application resource group where SAP system resources will be - deployed. Required. - :paramtype app_resource_group: str - :keyword network_configuration: Network configuration common to all servers. - :paramtype network_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.NetworkConfiguration - :keyword central_server: The central server configuration. Required. - :paramtype central_server: - ~azure.mgmt.workloadssapvirtualinstance.models.CentralServerConfiguration - :keyword application_server: The application server configuration. Required. - :paramtype application_server: - ~azure.mgmt.workloadssapvirtualinstance.models.ApplicationServerConfiguration - :keyword database_server: The database configuration. Required. - :paramtype database_server: - ~azure.mgmt.workloadssapvirtualinstance.models.DatabaseConfiguration - :keyword high_availability_config: The high availability configuration. - :paramtype high_availability_config: - ~azure.mgmt.workloadssapvirtualinstance.models.HighAvailabilityConfiguration - :keyword storage_configuration: The storage configuration. - :paramtype storage_configuration: - ~azure.mgmt.workloadssapvirtualinstance.models.StorageConfiguration - :keyword custom_resource_names: The set of custom names to be used for underlying azure - resources that are part of the SAP system. - :paramtype custom_resource_names: - ~azure.mgmt.workloadssapvirtualinstance.models.ThreeTierCustomResourceNames - """ - super().__init__(app_resource_group=app_resource_group, **kwargs) - self.deployment_type: str = "ThreeTier" - 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 - self.storage_configuration = storage_configuration - self.custom_resource_names = custom_resource_names - - -class ThreeTierCustomResourceNames(_serialization.Model): - """The resource-names input to specify custom names for underlying azure resources that are part - of a three tier SAP system. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ThreeTierFullResourceNames - - All required parameters must be populated in order to send to Azure. - - :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. - "FullResourceName" - :vartype naming_pattern_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.NamingPatternType - """ - - _validation = { - "naming_pattern_type": {"required": True}, - } - - _attribute_map = { - "naming_pattern_type": {"key": "namingPatternType", "type": "str"}, - } - - _subtype_map = {"naming_pattern_type": {"FullResourceName": "ThreeTierFullResourceNames"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.naming_pattern_type: Optional[str] = None - - -class ThreeTierFullResourceNames(ThreeTierCustomResourceNames): - """The resource name object where the specified values will be full resource names of the - corresponding resources in a three tier SAP system. - - All required parameters must be populated in order to send to Azure. - - :ivar naming_pattern_type: The pattern type to be used for resource naming. Required. - "FullResourceName" - :vartype naming_pattern_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.NamingPatternType - :ivar central_server: The full resource names object for central server layer resources. - :vartype central_server: - ~azure.mgmt.workloadssapvirtualinstance.models.CentralServerFullResourceNames - :ivar application_server: The full resource names object for application layer resources. The - number of entries in this list should be equal to the number VMs to be created for application - layer. - :vartype application_server: - ~azure.mgmt.workloadssapvirtualinstance.models.ApplicationServerFullResourceNames - :ivar database_server: The full resource names object for database layer resources. The number - of entries in this list should be equal to the number VMs to be created for database layer. - :vartype database_server: - ~azure.mgmt.workloadssapvirtualinstance.models.DatabaseServerFullResourceNames - :ivar shared_storage: The resource names object for shared storage. - :vartype shared_storage: - ~azure.mgmt.workloadssapvirtualinstance.models.SharedStorageResourceNames - """ - - _validation = { - "naming_pattern_type": {"required": True}, - } - - _attribute_map = { - "naming_pattern_type": {"key": "namingPatternType", "type": "str"}, - "central_server": {"key": "centralServer", "type": "CentralServerFullResourceNames"}, - "application_server": {"key": "applicationServer", "type": "ApplicationServerFullResourceNames"}, - "database_server": {"key": "databaseServer", "type": "DatabaseServerFullResourceNames"}, - "shared_storage": {"key": "sharedStorage", "type": "SharedStorageResourceNames"}, - } - - def __init__( - self, - *, - central_server: Optional["_models.CentralServerFullResourceNames"] = None, - application_server: Optional["_models.ApplicationServerFullResourceNames"] = None, - database_server: Optional["_models.DatabaseServerFullResourceNames"] = None, - shared_storage: Optional["_models.SharedStorageResourceNames"] = None, - **kwargs: Any - ) -> None: - """ - :keyword central_server: The full resource names object for central server layer resources. - :paramtype central_server: - ~azure.mgmt.workloadssapvirtualinstance.models.CentralServerFullResourceNames - :keyword application_server: The full resource names object for application layer resources. - The number of entries in this list should be equal to the number VMs to be created for - application layer. - :paramtype application_server: - ~azure.mgmt.workloadssapvirtualinstance.models.ApplicationServerFullResourceNames - :keyword database_server: The full resource names object for database layer resources. The - number of entries in this list should be equal to the number VMs to be created for database - layer. - :paramtype database_server: - ~azure.mgmt.workloadssapvirtualinstance.models.DatabaseServerFullResourceNames - :keyword shared_storage: The resource names object for shared storage. - :paramtype shared_storage: - ~azure.mgmt.workloadssapvirtualinstance.models.SharedStorageResourceNames - """ - super().__init__(**kwargs) - self.naming_pattern_type: str = "FullResourceName" - self.central_server = central_server - self.application_server = application_server - self.database_server = database_server - self.shared_storage = shared_storage - - -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: The type of SAP deployment, single server or Three tier. Required. Known - values are: "SingleServer" and "ThreeTier". - :vartype deployment_type: str or - ~azure.mgmt.workloadssapvirtualinstance.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: int - :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: int - :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: int - """ - - _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": "int"}, - "central_server_vm_sku": {"key": "centralServerVmSku", "type": "str"}, - "central_server_instance_count": {"key": "centralServerInstanceCount", "type": "int"}, - "application_server_vm_sku": {"key": "applicationServerVmSku", "type": "str"}, - "application_server_instance_count": {"key": "applicationServerInstanceCount", "type": "int"}, - } - - 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: Any - ) -> None: - """ - :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: int - :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: int - :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: int - """ - super().__init__(**kwargs) - self.deployment_type: str = "ThreeTier" - 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 UpdateSAPApplicationInstanceRequest(_serialization.Model): - """Defines the request body for updating SAP Application Instance. - - :ivar 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: Any) -> None: - """ - :keyword tags: Gets or sets the Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class UpdateSAPCentralInstanceRequest(_serialization.Model): - """Defines the request body for updating SAP Central Instance. - - :ivar 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: Any) -> None: - """ - :keyword tags: Gets or sets the Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class UpdateSAPDatabaseInstanceRequest(_serialization.Model): - """Defines the request body for updating SAP Database Instance. - - :ivar 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: Any) -> None: - """ - :keyword tags: Gets or sets the Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class UpdateSAPVirtualInstanceProperties(_serialization.Model): - """Defines the properties to be updated for Virtual Instance for SAP. - - :ivar managed_resources_network_access_type: Specifies the network access configuration for the - resources that will be deployed in the Managed Resource Group. The options to choose from are - Public and Private. If 'Private' is chosen, the Storage Account service tag should be enabled - on the subnets in which the SAP VMs exist. This is required for establishing connectivity - between VM extensions and the managed resource group storage account. This setting is currently - applicable only to Storage Account. Learn more here - https://go.microsoft.com/fwlink/?linkid=2247228. Known values are: "Public" and "Private". - :vartype managed_resources_network_access_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.ManagedResourcesNetworkAccessType - """ - - _attribute_map = { - "managed_resources_network_access_type": {"key": "managedResourcesNetworkAccessType", "type": "str"}, - } - - def __init__( - self, - *, - managed_resources_network_access_type: Optional[Union[str, "_models.ManagedResourcesNetworkAccessType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword managed_resources_network_access_type: Specifies the network access configuration for - the resources that will be deployed in the Managed Resource Group. The options to choose from - are Public and Private. If 'Private' is chosen, the Storage Account service tag should be - enabled on the subnets in which the SAP VMs exist. This is required for establishing - connectivity between VM extensions and the managed resource group storage account. This setting - is currently applicable only to Storage Account. Learn more here - https://go.microsoft.com/fwlink/?linkid=2247228. Known values are: "Public" and "Private". - :paramtype managed_resources_network_access_type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.ManagedResourcesNetworkAccessType - """ - super().__init__(**kwargs) - self.managed_resources_network_access_type = managed_resources_network_access_type - - -class UpdateSAPVirtualInstanceRequest(_serialization.Model): - """Defines the request body for updating Virtual Instance for SAP. - - :ivar tags: Gets or sets the Resource tags. - :vartype tags: dict[str, str] - :ivar identity: Managed service identity (user assigned identities). - :vartype identity: ~azure.mgmt.workloadssapvirtualinstance.models.UserAssignedServiceIdentity - :ivar properties: Defines the properties to be updated for Virtual Instance for SAP. - :vartype properties: - ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPVirtualInstanceProperties - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "UserAssignedServiceIdentity"}, - "properties": {"key": "properties", "type": "UpdateSAPVirtualInstanceProperties"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.UserAssignedServiceIdentity"] = None, - properties: Optional["_models.UpdateSAPVirtualInstanceProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Gets or sets the Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed service identity (user assigned identities). - :paramtype identity: ~azure.mgmt.workloadssapvirtualinstance.models.UserAssignedServiceIdentity - :keyword properties: Defines the properties to be updated for Virtual Instance for SAP. - :paramtype properties: - ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPVirtualInstanceProperties - """ - super().__init__(**kwargs) - self.tags = tags - self.identity = identity - self.properties = properties - - -class UserAssignedIdentity(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class UserAssignedServiceIdentity(_serialization.Model): - """Managed service identity (user assigned identities). - - All required parameters must be populated in order to send to Azure. - - :ivar type: Type of manage identity. Required. Known values are: "None" and "UserAssigned". - :vartype type: str or ~azure.mgmt.workloadssapvirtualinstance.models.ManagedServiceIdentityType - :ivar user_assigned_identities: User assigned identities dictionary. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.workloadssapvirtualinstance.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, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of manage identity. Required. Known values are: "None" and "UserAssigned". - :paramtype type: str or - ~azure.mgmt.workloadssapvirtualinstance.models.ManagedServiceIdentityType - :keyword user_assigned_identities: User assigned identities dictionary. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.workloadssapvirtualinstance.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class VirtualMachineConfiguration(_serialization.Model): - """Defines the virtual machine configuration. - - All required parameters must be populated in order to send to Azure. - - :ivar vm_size: The virtual machine size. Required. - :vartype vm_size: str - :ivar image_reference: The image reference. Required. - :vartype image_reference: ~azure.mgmt.workloadssapvirtualinstance.models.ImageReference - :ivar os_profile: The OS profile. Required. - :vartype os_profile: ~azure.mgmt.workloadssapvirtualinstance.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: "_models.ImageReference", os_profile: "_models.OSProfile", **kwargs: Any - ) -> None: - """ - :keyword vm_size: The virtual machine size. Required. - :paramtype vm_size: str - :keyword image_reference: The image reference. Required. - :paramtype image_reference: ~azure.mgmt.workloadssapvirtualinstance.models.ImageReference - :keyword os_profile: The OS profile. Required. - :paramtype os_profile: ~azure.mgmt.workloadssapvirtualinstance.models.OSProfile - """ - super().__init__(**kwargs) - self.vm_size = vm_size - self.image_reference = image_reference - self.os_profile = os_profile - - -class VirtualMachineResourceNames(_serialization.Model): - """The resource names object for virtual machine and related resources. - - :ivar vm_name: The full name for virtual machine. The length of this field can be upto 64 - characters. If name is not provided, service uses a default name based on the deployment type. - For SingleServer, default name is {SID}vm. In case of HA-AvZone systems, default name will be - {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end in case of more than 1 vm per layer. - For distributed and HA-AvSet systems, default name will be {SID}{app/ascs/db}vm with an - incrementor at the end in case of more than 1 vm per layer. - :vartype vm_name: str - :ivar host_name: The full name for virtual-machine's host (computer name). Currently, ACSS only - supports host names which are less than or equal to 13 characters long. If this value is not - provided, vmName will be used as host name. - :vartype host_name: str - :ivar network_interfaces: The list of network interface name objects for the selected virtual - machine. Currently, only one network interface is supported per virtual machine. - :vartype network_interfaces: - list[~azure.mgmt.workloadssapvirtualinstance.models.NetworkInterfaceResourceNames] - :ivar os_disk_name: The full name for OS disk attached to the VM. If this value is not - provided, it will be named by ARM as per its default naming standards (prefixed with vm name). - There is only one OS disk attached per Virtual Machine. - :vartype os_disk_name: str - :ivar data_disk_names: The full resource names for virtual machine data disks. This is a - dictionary containing list of names of data disks per volume. Currently supported volumes for - database layer are ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For - application and cs layers, only 'default' volume is supported. - :vartype data_disk_names: dict[str, list[str]] - """ - - _validation = { - "network_interfaces": {"max_items": 1, "min_items": 0}, - } - - _attribute_map = { - "vm_name": {"key": "vmName", "type": "str"}, - "host_name": {"key": "hostName", "type": "str"}, - "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterfaceResourceNames]"}, - "os_disk_name": {"key": "osDiskName", "type": "str"}, - "data_disk_names": {"key": "dataDiskNames", "type": "{[str]}"}, - } - - def __init__( - self, - *, - vm_name: Optional[str] = None, - host_name: Optional[str] = None, - network_interfaces: Optional[List["_models.NetworkInterfaceResourceNames"]] = None, - os_disk_name: Optional[str] = None, - data_disk_names: Optional[Dict[str, List[str]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword vm_name: The full name for virtual machine. The length of this field can be upto 64 - characters. If name is not provided, service uses a default name based on the deployment type. - For SingleServer, default name is {SID}vm. In case of HA-AvZone systems, default name will be - {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end in case of more than 1 vm per layer. - For distributed and HA-AvSet systems, default name will be {SID}{app/ascs/db}vm with an - incrementor at the end in case of more than 1 vm per layer. - :paramtype vm_name: str - :keyword host_name: The full name for virtual-machine's host (computer name). Currently, ACSS - only supports host names which are less than or equal to 13 characters long. If this value is - not provided, vmName will be used as host name. - :paramtype host_name: str - :keyword network_interfaces: The list of network interface name objects for the selected - virtual machine. Currently, only one network interface is supported per virtual machine. - :paramtype network_interfaces: - list[~azure.mgmt.workloadssapvirtualinstance.models.NetworkInterfaceResourceNames] - :keyword os_disk_name: The full name for OS disk attached to the VM. If this value is not - provided, it will be named by ARM as per its default naming standards (prefixed with vm name). - There is only one OS disk attached per Virtual Machine. - :paramtype os_disk_name: str - :keyword data_disk_names: The full resource names for virtual machine data disks. This is a - dictionary containing list of names of data disks per volume. Currently supported volumes for - database layer are ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For - application and cs layers, only 'default' volume is supported. - :paramtype data_disk_names: dict[str, list[str]] - """ - super().__init__(**kwargs) - self.vm_name = vm_name - self.host_name = host_name - self.network_interfaces = network_interfaces - self.os_disk_name = os_disk_name - self.data_disk_names = data_disk_names - - -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: The OS Type. Required. Known values are: "Linux" and "Windows". - :vartype os_type: str or ~azure.mgmt.workloadssapvirtualinstance.models.OSType - """ - - _validation = { - "os_type": {"required": True}, - } - - _attribute_map = { - "os_type": {"key": "osType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.os_type: str = "Windows" diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/__init__.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/__init__.py index b5dcb87baf6c6..f607fa6f285be 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/__init__.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/__init__.py @@ -2,28 +2,32 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._workloads_sap_virtual_instance_mgmt_client_operations import WorkloadsSapVirtualInstanceMgmtClientOperationsMixin -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 typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import SAPVirtualInstancesOperations # type: ignore +from ._operations import SAPCentralServerInstancesOperations # type: ignore +from ._operations import SAPDatabaseInstancesOperations # type: ignore +from ._operations import SAPApplicationServerInstancesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "WorkloadsSapVirtualInstanceMgmtClientOperationsMixin", + "Operations", "SAPVirtualInstancesOperations", - "SAPCentralInstancesOperations", + "SAPCentralServerInstancesOperations", "SAPDatabaseInstancesOperations", "SAPApplicationServerInstancesOperations", - "Operations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_operations.py index 0259a951bbea1..fa3ec4d32045a 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_operations.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_operations.py @@ -3,10 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -15,36 +18,44 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._serialization import Serializer -from .._vendor import WorkloadsSapVirtualInstanceMgmtClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Workloads/operations") + _url = "/providers/Microsoft.Workloads/operations" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -55,6 +66,1073 @@ def build_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_sap_virtual_instances_get_request( + resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_virtual_instances_create_request( # pylint: disable=name-too-long + resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_virtual_instances_update_request( # pylint: disable=name-too-long + resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_virtual_instances_delete_request( # pylint: disable=name-too-long + resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_virtual_instances_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_virtual_instances_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_virtual_instances_start_request( # pylint: disable=name-too-long + resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_virtual_instances_stop_request( + resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_virtual_instances_get_sizing_recommendations_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_virtual_instances_get_sap_supported_sku_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_virtual_instances_get_disk_configurations_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_virtual_instances_get_availability_zone_details_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_central_server_instances_get_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_central_server_instances_create_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_central_server_instances_update_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_central_server_instances_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_central_server_instances_list_request( # pylint: disable=name-too-long + resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_central_server_instances_start_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_central_server_instances_stop_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_database_instances_get_request( + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_database_instances_create_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_database_instances_update_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_database_instances_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_database_instances_list_request( # pylint: disable=name-too-long + resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_database_instances_start_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_database_instances_stop_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_application_server_instances_get_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_application_server_instances_create_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_application_server_instances_update_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_application_server_instances_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_application_server_instances_list_request( # pylint: disable=name-too-long + resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_application_server_instances_start_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sap_application_server_instances_stop_request( # pylint: disable=name-too-long + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"), + "applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class Operations: """ .. warning:: @@ -62,11 +1140,4639 @@ class Operations: Instead, you should access the following operations through :class:`~azure.mgmt.workloadssapvirtualinstance.WorkloadsSapVirtualInstanceMgmtClient`'s - :attr:`operations` attribute. + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SAPVirtualInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloadssapvirtualinstance.WorkloadsSapVirtualInstanceMgmtClient`'s + :attr:`sap_virtual_instances` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> _models.SAPVirtualInstance: + """Gets a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :return: SAPVirtualInstance. The SAPVirtualInstance is compatible with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) + + _request = build_sap_virtual_instances_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPVirtualInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + resource: Union[_models.SAPVirtualInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_virtual_instances_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + resource: _models.SAPVirtualInstance, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param resource: Virtual Instance for SAP solutions resource request body. Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPVirtualInstance. The SAPVirtualInstance is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param resource: Virtual Instance for SAP solutions resource request body. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPVirtualInstance. The SAPVirtualInstance is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param resource: Virtual Instance for SAP solutions resource request body. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPVirtualInstance. The SAPVirtualInstance is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + resource: Union[_models.SAPVirtualInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Creates a Virtual Instance for SAP solutions (VIS) resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param resource: Virtual Instance for SAP solutions resource request body. Is one of the + following types: SAPVirtualInstance, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance or JSON or + IO[bytes] + :return: An instance of LROPoller that returns SAPVirtualInstance. The SAPVirtualInstance is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SAPVirtualInstance, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SAPVirtualInstance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SAPVirtualInstance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + properties: Union[_models.UpdateSAPVirtualInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_virtual_instances_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + properties: _models.UpdateSAPVirtualInstanceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param properties: Request body to update a Virtual Instance for SAP solutions resource. + Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPVirtualInstanceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPVirtualInstance. The SAPVirtualInstance is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param properties: Request body to update a Virtual Instance for SAP solutions resource. + Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPVirtualInstance. The SAPVirtualInstance is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param properties: Request body to update a Virtual Instance for SAP solutions resource. + Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPVirtualInstance. The SAPVirtualInstance is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + properties: Union[_models.UpdateSAPVirtualInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SAPVirtualInstance]: + """Updates a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param properties: Request body to update a Virtual Instance for SAP solutions resource. Is one + of the following types: UpdateSAPVirtualInstanceRequest, JSON, IO[bytes] Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPVirtualInstanceRequest or JSON or + IO[bytes] + :return: An instance of LROPoller that returns SAPVirtualInstance. The SAPVirtualInstance is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SAPVirtualInstance, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SAPVirtualInstance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SAPVirtualInstance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_sap_virtual_instances_delete_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a Virtual Instance for SAP solutions resource and its child resources, that is the + associated Central Services Instance, Application Server Instances and Database Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SAPVirtualInstance"]: + """Gets all Virtual Instances for SAP solutions resources in a Resource Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of SAPVirtualInstance + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SAPVirtualInstance]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_sap_virtual_instances_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SAPVirtualInstance], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SAPVirtualInstance"]: + """Gets all Virtual Instances for SAP solutions resources in a Subscription. + + :return: An iterator like instance of SAPVirtualInstance + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SAPVirtualInstance]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_sap_virtual_instances_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SAPVirtualInstance], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _start_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_virtual_instances_start_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Default value + is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Default value + is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Default value + is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP application, that is the Central Services instance and Application server + instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource start request body. Is one of the + following types: StartRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _stop_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_virtual_instances_stop_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Default value + is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Default value + is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Default value + is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application, that is the Application server instances and Central Services + instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param body: The Virtual Instance for SAP solutions resource stop request body. Is one of the + following types: StopRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def get_sizing_recommendations( + self, + location: str, + body: _models.SAPSizingRecommendationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Gets the sizing recommendations. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPSizingRecommendationResult. The SAPSizingRecommendationResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_sizing_recommendations( + self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Gets the sizing recommendations. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPSizingRecommendationResult. The SAPSizingRecommendationResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_sizing_recommendations( + self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Gets the sizing recommendations. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPSizingRecommendationResult. The SAPSizingRecommendationResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_sizing_recommendations( + self, location: str, body: Union[_models.SAPSizingRecommendationRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.SAPSizingRecommendationResult: + """Gets the sizing recommendations. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Is one of the following types: + SAPSizingRecommendationRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationRequest or + JSON or IO[bytes] + :return: SAPSizingRecommendationResult. The SAPSizingRecommendationResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPSizingRecommendationResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_virtual_instances_get_sizing_recommendations_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPSizingRecommendationResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def get_sap_supported_sku( + self, + location: str, + body: _models.SAPSupportedSkusRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedSkusRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPSupportedResourceSkusResult. The SAPSupportedResourceSkusResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_sap_supported_sku( + self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPSupportedResourceSkusResult. The SAPSupportedResourceSkusResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_sap_supported_sku( + self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPSupportedResourceSkusResult. The SAPSupportedResourceSkusResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_sap_supported_sku( + self, location: str, body: Union[_models.SAPSupportedSkusRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.SAPSupportedResourceSkusResult: + """Get a list of SAP supported SKUs for ASCS, Application and Database tier. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Is one of the following types: + SAPSupportedSkusRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedSkusRequest or JSON or + IO[bytes] + :return: SAPSupportedResourceSkusResult. The SAPSupportedResourceSkusResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPSupportedResourceSkusResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_virtual_instances_get_sap_supported_sku_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPSupportedResourceSkusResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def get_disk_configurations( + self, + location: str, + body: _models.SAPDiskConfigurationsRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPDiskConfigurationsResult. The SAPDiskConfigurationsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_disk_configurations( + self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPDiskConfigurationsResult. The SAPDiskConfigurationsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_disk_configurations( + self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPDiskConfigurationsResult. The SAPDiskConfigurationsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_disk_configurations( + self, location: str, body: Union[_models.SAPDiskConfigurationsRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.SAPDiskConfigurationsResult: + """Get the SAP Disk Configuration Layout prod/non-prod SAP System. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Is one of the following types: + SAPDiskConfigurationsRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsRequest or JSON + or IO[bytes] + :return: SAPDiskConfigurationsResult. The SAPDiskConfigurationsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPDiskConfigurationsResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_virtual_instances_get_disk_configurations_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPDiskConfigurationsResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def get_availability_zone_details( + self, + location: str, + body: _models.SAPAvailabilityZoneDetailsRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPAvailabilityZoneDetailsResult. The SAPAvailabilityZoneDetailsResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_availability_zone_details( + self, location: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPAvailabilityZoneDetailsResult. The SAPAvailabilityZoneDetailsResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_availability_zone_details( + self, location: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPAvailabilityZoneDetailsResult. The SAPAvailabilityZoneDetailsResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_availability_zone_details( + self, location: str, body: Union[_models.SAPAvailabilityZoneDetailsRequest, JSON, IO[bytes]], **kwargs: Any + ) -> _models.SAPAvailabilityZoneDetailsResult: + """Get the recommended SAP Availability Zone Pair Details for your region. + + :param location: The name of the Azure region. Required. + :type location: str + :param body: The content of the action request. Is one of the following types: + SAPAvailabilityZoneDetailsRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsRequest or + JSON or IO[bytes] + :return: SAPAvailabilityZoneDetailsResult. The SAPAvailabilityZoneDetailsResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPAvailabilityZoneDetailsResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_virtual_instances_get_availability_zone_details_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPAvailabilityZoneDetailsResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class SAPCentralServerInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloadssapvirtualinstance.WorkloadsSapVirtualInstanceMgmtClient`'s + :attr:`sap_central_server_instances` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Gets the SAP Central Services Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :return: SAPCentralServerInstance. The SAPCentralServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) + + _request = build_sap_central_server_instances_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPCentralServerInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + resource: Union[_models.SAPCentralServerInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_central_server_instances_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + resource: _models.SAPCentralServerInstance, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. <br><br>This will be used by + service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param resource: The SAP Central Services Instance request body. Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPCentralServerInstance. The + SAPCentralServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. <br><br>This will be used by + service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param resource: The SAP Central Services Instance request body. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPCentralServerInstance. The + SAPCentralServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. <br><br>This will be used by + service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param resource: The SAP Central Services Instance request body. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPCentralServerInstance. The + SAPCentralServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + resource: Union[_models.SAPCentralServerInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SAPCentralServerInstance]: + """Creates the SAP Central Services Instance resource. <br><br>This will be used by + service only. PUT operation on this resource by end user will return a Bad Request error. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param resource: The SAP Central Services Instance request body. Is one of the following types: + SAPCentralServerInstance, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance or JSON + or IO[bytes] + :return: An instance of LROPoller that returns SAPCentralServerInstance. The + SAPCentralServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SAPCentralServerInstance, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SAPCentralServerInstance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SAPCentralServerInstance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + properties: _models.UpdateSAPCentralInstanceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. <br><br>This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param properties: The SAP Central Services Instance resource request body. Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPCentralInstanceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPCentralServerInstance. The SAPCentralServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. <br><br>This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param properties: The SAP Central Services Instance resource request body. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPCentralServerInstance. The SAPCentralServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. <br><br>This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param properties: The SAP Central Services Instance resource request body. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPCentralServerInstance. The SAPCentralServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + properties: Union[_models.UpdateSAPCentralInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SAPCentralServerInstance: + """Updates the SAP Central Services Instance resource. <br><br>This can be used to + update tags on the resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param properties: The SAP Central Services Instance resource request body. Is one of the + following types: UpdateSAPCentralInstanceRequest, JSON, IO[bytes] Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPCentralInstanceRequest or JSON or + IO[bytes] + :return: SAPCentralServerInstance. The SAPCentralServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_central_server_instances_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPCentralServerInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_sap_central_server_instances_delete_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the SAP Central Services Instance resource. <br><br>This will be used by + service only. Delete operation on this resource by end user will return a Bad Request error. + You can delete the parent resource, which is the Virtual Instance for SAP solutions resource, + using the delete operation on it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> Iterable["_models.SAPCentralServerInstance"]: + """Lists the SAP Central Services Instance resource for the given Virtual Instance for SAP + solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :return: An iterator like instance of SAPCentralServerInstance + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SAPCentralServerInstance]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_sap_central_server_instances_list_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SAPCentralServerInstance], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _start_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_central_server_instances_start_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance start request body. Is one of the following types: + StartRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _stop_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_central_server_instances_stop_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + central_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Central Services Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param central_instance_name: Central Services Instance resource name string modeled as + parameter for auto generation to work correctly. Required. + :type central_instance_name: str + :param body: SAP Central Services instance stop request body. Is one of the following types: + StopRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + central_instance_name=central_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class SAPDatabaseInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloadssapvirtualinstance.WorkloadsSapVirtualInstanceMgmtClient`'s + :attr:`sap_database_instances` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Gets the SAP Database Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :return: SAPDatabaseInstance. The SAPDatabaseInstance is compatible with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) + + _request = build_sap_database_instances_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPDatabaseInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + resource: Union[_models.SAPDatabaseInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_database_instances_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + resource: _models.SAPDatabaseInstance, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param resource: Request body of Database resource of a SAP system. Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPDatabaseInstance. The SAPDatabaseInstance is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param resource: Request body of Database resource of a SAP system. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPDatabaseInstance. The SAPDatabaseInstance is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param resource: Request body of Database resource of a SAP system. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPDatabaseInstance. The SAPDatabaseInstance is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + resource: Union[_models.SAPDatabaseInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SAPDatabaseInstance]: + """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. + <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param resource: Request body of Database resource of a SAP system. Is one of the following + types: SAPDatabaseInstance, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance or JSON or + IO[bytes] + :return: An instance of LROPoller that returns SAPDatabaseInstance. The SAPDatabaseInstance is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SAPDatabaseInstance, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SAPDatabaseInstance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SAPDatabaseInstance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + properties: _models.UpdateSAPDatabaseInstanceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param properties: Database resource update request body. Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPDatabaseInstanceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPDatabaseInstance. The SAPDatabaseInstance is compatible with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param properties: Database resource update request body. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPDatabaseInstance. The SAPDatabaseInstance is compatible with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param properties: Database resource update request body. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPDatabaseInstance. The SAPDatabaseInstance is compatible with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + properties: Union[_models.UpdateSAPDatabaseInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SAPDatabaseInstance: + """Updates the Database resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param properties: Database resource update request body. Is one of the following types: + UpdateSAPDatabaseInstanceRequest, JSON, IO[bytes] Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPDatabaseInstanceRequest or JSON or + IO[bytes] + :return: SAPDatabaseInstance. The SAPDatabaseInstance is compatible with MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_database_instances_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPDatabaseInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_sap_database_instances_delete_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. + <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> Iterable["_models.SAPDatabaseInstance"]: + """Lists the Database resources associated with a Virtual Instance for SAP solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :return: An iterator like instance of SAPDatabaseInstance + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SAPDatabaseInstance]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_sap_database_instances_list_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SAPDatabaseInstance], deserialized["value"]) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _start_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_database_instances_start_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: SAP Database server instance start request body. Is one of the following types: + StartRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _stop_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_database_instances_stop_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + database_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the database instance of the SAP system. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param database_instance_name: Database resource name string modeled as parameter for auto + generation to work correctly. Required. + :type database_instance_name: str + :param body: Stop request for the database instance of the SAP system. Is one of the following + types: StopRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + database_instance_name=database_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class SAPApplicationServerInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.workloadssapvirtualinstance.WorkloadsSapVirtualInstanceMgmtClient`'s + :attr:`sap_application_server_instances` attribute. """ - models = _models - def __init__(self, *args, **kwargs): input_args = list(args) self._client = input_args.pop(0) if input_args else kwargs.pop("client") @@ -75,21 +5781,685 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """Lists all the available API operations under this PR. + 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 corresponding to the Virtual Instance for SAP + solutions resource. - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.Operation] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :return: SAPApplicationServerInstance. The SAPApplicationServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) + + _request = build_sap_application_server_instances_get_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPApplicationServerInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + resource: Union[_models.SAPApplicationServerInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_application_server_instances_create_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + resource: _models.SAPApplicationServerInstance, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param resource: The SAP Application Server Instance resource request body. Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPApplicationServerInstance. The + SAPApplicationServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param resource: The SAP Application Server Instance resource request body. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPApplicationServerInstance. The + SAPApplicationServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param resource: The SAP Application Server Instance resource request body. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SAPApplicationServerInstance. The + SAPApplicationServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + resource: Union[_models.SAPApplicationServerInstance, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SAPApplicationServerInstance]: + """Puts the SAP Application Server Instance resource. <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param resource: The SAP Application Server Instance resource request body. Is one of the + following types: SAPApplicationServerInstance, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance or + JSON or IO[bytes] + :return: An instance of LROPoller that returns SAPApplicationServerInstance. The + SAPApplicationServerInstance is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SAPApplicationServerInstance, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SAPApplicationServerInstance].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SAPApplicationServerInstance]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + properties: _models.UpdateSAPApplicationInstanceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Puts the SAP Application Server Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param properties: The SAP Application Server Instance resource request body. Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPApplicationInstanceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPApplicationServerInstance. The SAPApplicationServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Puts the SAP Application Server Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param properties: The SAP Application Server Instance resource request body. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPApplicationServerInstance. The SAPApplicationServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Puts the SAP Application Server Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param properties: The SAP Application Server Instance resource request body. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SAPApplicationServerInstance. The SAPApplicationServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + properties: Union[_models.UpdateSAPApplicationInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SAPApplicationServerInstance: + """Puts the SAP Application Server Instance resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param properties: The SAP Application Server Instance resource request body. Is one of the + following types: UpdateSAPApplicationInstanceRequest, JSON, IO[bytes] Required. + :type properties: + ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPApplicationInstanceRequest or JSON or + IO[bytes] + :return: SAPApplicationServerInstance. The SAPApplicationServerInstance is compatible with + MutableMapping + :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sap_application_server_instances_update_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SAPApplicationServerInstance, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_sap_application_server_instances_delete_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the SAP Application Server Instance resource. <br><br>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. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any + ) -> Iterable["_models.SAPApplicationServerInstance"]: + """Lists the SAP Application Server Instance resources for a given Virtual Instance for SAP + solutions resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :return: An iterator like instance of SAPApplicationServerInstance + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SAPApplicationServerInstance]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,14 +6470,20 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: 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 = build_sap_application_server_instances_list_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -119,37 +6495,567 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.SAPApplicationServerInstance], deserialized["value"]) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) 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"} + def _start_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_application_server_instances_start_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.StartRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StartRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Starts the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance start request body. Is one of the following types: + StartRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _stop_initial( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_sap_application_server_instances_stop_request( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[_models.StopRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop( + self, + resource_group_name: str, + sap_virtual_instance_name: str, + application_instance_name: str, + body: Optional[Union[_models.StopRequest, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationStatusResult]: + """Stops the SAP Application Server Instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. + Required. + :type sap_virtual_instance_name: str + :param application_instance_name: The name of SAP Application Server instance resource. + Required. + :type application_instance_name: str + :param body: SAP Application server instance stop request body. Is one of the following types: + StopRequest, JSON, IO[bytes] Default value is None. + :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationStatusResult. The OperationStatusResult + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + sap_virtual_instance_name=sap_virtual_instance_name, + application_instance_name=application_instance_name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.OperationStatusResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationStatusResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_sap_application_server_instances_operations.py deleted file mode 100644 index 4c49dbde8b44a..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_sap_application_server_instances_operations.py +++ /dev/null @@ -1,1581 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import WorkloadsSapVirtualInstanceMgmtClientMixinABC, _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_get_request( - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "applicationInstanceName": _SERIALIZER.url( - "application_instance_name", application_instance_name, "str", pattern=r"^.*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "applicationInstanceName": _SERIALIZER.url( - "application_instance_name", application_instance_name, "str", pattern=r"^.*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "applicationInstanceName": _SERIALIZER.url( - "application_instance_name", application_instance_name, "str", pattern=r"^.*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "applicationInstanceName": _SERIALIZER.url( - "application_instance_name", application_instance_name, "str", pattern=r"^.*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_instance_request( - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "applicationInstanceName": _SERIALIZER.url( - "application_instance_name", application_instance_name, "str", pattern=r"^.*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_instance_request( - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "applicationInstanceName": _SERIALIZER.url( - "application_instance_name", application_instance_name, "str", pattern=r"^.*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class SAPApplicationServerInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.workloadssapvirtualinstance.WorkloadsSapVirtualInstanceMgmtClient`'s - :attr:`sap_application_server_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any - ) -> _models.SAPApplicationServerInstance: - """Gets the SAP Application Server Instance corresponding to the Virtual Instance for SAP - solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :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.workloadssapvirtualinstance.models.SAPApplicationServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}" - } - - def _create_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.SAPApplicationServerInstance, IO]] = None, - **kwargs: Any - ) -> _models.SAPApplicationServerInstance: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "SAPApplicationServerInstance") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, 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, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" - } - - @overload - def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[_models.SAPApplicationServerInstance] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SAPApplicationServerInstance]: - """Puts the SAP Application Server Instance resource. :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: The SAP Application Server Instance resource request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPApplicationServerInstance or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SAPApplicationServerInstance]: - """Puts the SAP Application Server Instance resource. :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: The SAP Application Server Instance resource request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPApplicationServerInstance or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.SAPApplicationServerInstance, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.SAPApplicationServerInstance]: - """Puts the SAP Application Server Instance resource. :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: The SAP Application Server Instance resource request body. Is either a - SAPApplicationServerInstance type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPApplicationServerInstance or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" - } - - @overload - def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[_models.UpdateSAPApplicationInstanceRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPApplicationServerInstance: - """Updates the SAP Application server instance resource. This can be used to update tags on the - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: The SAP Application Server Instance resource request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPApplicationInstanceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPApplicationServerInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPApplicationServerInstance: - """Updates the SAP Application server instance resource. This can be used to update tags on the - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: The SAP Application Server Instance resource request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPApplicationServerInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.UpdateSAPApplicationInstanceRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPApplicationServerInstance: - """Updates the SAP Application server instance resource. This can be used to update tags on the - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: The SAP Application Server Instance resource request body. Is either a - UpdateSAPApplicationInstanceRequest type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPApplicationInstanceRequest - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPApplicationServerInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPApplicationServerInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "UpdateSAPApplicationInstanceRequest") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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 - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 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) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, sap_virtual_instance_name: str, application_instance_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes the SAP Application Server Instance resource. :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> Iterable["_models.SAPApplicationServerInstance"]: - """Lists the SAP Application Server Instance resources for a given Virtual Instance for SAP - solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :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 SAPApplicationServerInstance or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPApplicationServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPApplicationServerInstanceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SAPApplicationServerInstanceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - def _start_instance_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StartRequest") - else: - _json = None - - request = build_start_instance_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._start_instance_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _start_instance_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" - } - - @overload - def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[_models.StartRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Starts the SAP Application Server Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: SAP Application server instance start request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Starts the SAP Application Server Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: SAP Application server instance start request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Starts the SAP Application Server Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: SAP Application server instance start request body. Is either a StartRequest type - or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_instance_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start" - } - - def _stop_instance_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StopRequest") - else: - _json = None - - request = build_stop_instance_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - application_instance_name=application_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._stop_instance_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _stop_instance_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" - } - - @overload - def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[_models.StopRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Stops the SAP Application Server Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: SAP Application server instance stop request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Stops the SAP Application Server Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: SAP Application server instance stop request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - application_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Stops the SAP Application Server Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param application_instance_name: The name of SAP Application Server instance resource. - Required. - :type application_instance_name: str - :param body: SAP Application server instance stop request body. Is either a StopRequest type or - a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_instance_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop" - } diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_sap_central_instances_operations.py deleted file mode 100644 index 912333e4d6c47..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_sap_central_instances_operations.py +++ /dev/null @@ -1,1570 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import WorkloadsSapVirtualInstanceMgmtClientMixinABC, _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_get_request( - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str", pattern=r"^.*"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str", pattern=r"^.*"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str", pattern=r"^.*"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str", pattern=r"^.*"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_instance_request( - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str", pattern=r"^.*"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_instance_request( - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str", pattern=r"^.*"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class SAPCentralInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.workloadssapvirtualinstance.WorkloadsSapVirtualInstanceMgmtClient`'s - :attr:`sap_central_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any - ) -> _models.SAPCentralServerInstance: - """Gets the SAP Central Services Instance resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :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.workloadssapvirtualinstance.models.SAPCentralServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}" - } - - def _create_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.SAPCentralServerInstance, IO]] = None, - **kwargs: Any - ) -> _models.SAPCentralServerInstance: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "SAPCentralServerInstance") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, 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, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" - } - - @overload - def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[_models.SAPCentralServerInstance] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SAPCentralServerInstance]: - """Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used - by service only. PUT operation on this resource by end user will return a Bad Request error. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: The SAP Central Services Instance request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPCentralServerInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SAPCentralServerInstance]: - """Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used - by service only. PUT operation on this resource by end user will return a Bad Request error. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: The SAP Central Services Instance request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPCentralServerInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.SAPCentralServerInstance, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.SAPCentralServerInstance]: - """Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used - by service only. PUT operation on this resource by end user will return a Bad Request error. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: The SAP Central Services Instance request body. Is either a - SAPCentralServerInstance type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPCentralServerInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" - } - - @overload - def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[_models.UpdateSAPCentralInstanceRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPCentralServerInstance: - """Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to - update tags on the resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: The SAP Central Services Instance resource request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPCentralInstanceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPCentralServerInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPCentralServerInstance: - """Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to - update tags on the resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: The SAP Central Services Instance resource request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPCentralServerInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.UpdateSAPCentralInstanceRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPCentralServerInstance: - """Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to - update tags on the resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: The SAP Central Services Instance resource request body. Is either a - UpdateSAPCentralInstanceRequest type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPCentralInstanceRequest or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPCentralServerInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPCentralServerInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "UpdateSAPCentralInstanceRequest") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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 - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 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) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, sap_virtual_instance_name: str, central_instance_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used - by service only. Delete operation on this resource by end user will return a Bad Request error. - You can delete the parent resource, which is the Virtual Instance for SAP solutions resource, - using the delete operation on it. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> Iterable["_models.SAPCentralServerInstance"]: - """Lists the SAP Central Services Instance resource for the given Virtual Instance for SAP - solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :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 SAPCentralServerInstance or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPCentralServerInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPCentralInstanceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SAPCentralInstanceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - def _start_instance_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StartRequest") - else: - _json = None - - request = build_start_instance_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._start_instance_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _start_instance_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" - } - - @overload - def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[_models.StartRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Starts the SAP Central Services Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: SAP Central Services instance start request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Starts the SAP Central Services Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: SAP Central Services instance start request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Starts the SAP Central Services Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: SAP Central Services instance start request body. Is either a StartRequest type or - a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_instance_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start" - } - - def _stop_instance_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StopRequest") - else: - _json = None - - request = build_stop_instance_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - central_instance_name=central_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._stop_instance_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _stop_instance_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" - } - - @overload - def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[_models.StopRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Stops the SAP Central Services Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: SAP Central Services instance stop request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Stops the SAP Central Services Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: SAP Central Services instance stop request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - central_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Stops the SAP Central Services Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param central_instance_name: Central Services Instance resource name string modeled as - parameter for auto generation to work correctly. Required. - :type central_instance_name: str - :param body: SAP Central Services instance stop request body. Is either a StopRequest type or a - IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_instance_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop" - } diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_sap_database_instances_operations.py deleted file mode 100644 index 587e95adeda5f..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_sap_database_instances_operations.py +++ /dev/null @@ -1,1579 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import WorkloadsSapVirtualInstanceMgmtClientMixinABC, _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_get_request( - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "databaseInstanceName": _SERIALIZER.url( - "database_instance_name", database_instance_name, "str", pattern=r"^.*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "databaseInstanceName": _SERIALIZER.url( - "database_instance_name", database_instance_name, "str", pattern=r"^.*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "databaseInstanceName": _SERIALIZER.url( - "database_instance_name", database_instance_name, "str", pattern=r"^.*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "databaseInstanceName": _SERIALIZER.url( - "database_instance_name", database_instance_name, "str", pattern=r"^.*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_instance_request( - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "databaseInstanceName": _SERIALIZER.url( - "database_instance_name", database_instance_name, "str", pattern=r"^.*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_instance_request( - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - "databaseInstanceName": _SERIALIZER.url( - "database_instance_name", database_instance_name, "str", pattern=r"^.*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class SAPDatabaseInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.workloadssapvirtualinstance.WorkloadsSapVirtualInstanceMgmtClient`'s - :attr:`sap_database_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any - ) -> _models.SAPDatabaseInstance: - """Gets the SAP Database Instance resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :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.workloadssapvirtualinstance.models.SAPDatabaseInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}" - } - - def _create_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.SAPDatabaseInstance, IO]] = None, - **kwargs: Any - ) -> _models.SAPDatabaseInstance: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "SAPDatabaseInstance") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, 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, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" - } - - @overload - def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[_models.SAPDatabaseInstance] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SAPDatabaseInstance]: - """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. - :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Request body of Database resource of a SAP system. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPDatabaseInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SAPDatabaseInstance]: - """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. - :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Request body of Database resource of a SAP system. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPDatabaseInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.SAPDatabaseInstance, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.SAPDatabaseInstance]: - """Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource. - :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Request body of Database resource of a SAP system. Is either a SAPDatabaseInstance - type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPDatabaseInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" - } - - @overload - def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[_models.UpdateSAPDatabaseInstanceRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPDatabaseInstance: - """Updates the Database instance resource. This can be used to update tags on the resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Database resource update request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPDatabaseInstanceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPDatabaseInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPDatabaseInstance: - """Updates the Database instance resource. This can be used to update tags on the resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Database resource update request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPDatabaseInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.UpdateSAPDatabaseInstanceRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPDatabaseInstance: - """Updates the Database instance resource. This can be used to update tags on the resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Database resource update request body. Is either a - UpdateSAPDatabaseInstanceRequest type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPDatabaseInstanceRequest or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPDatabaseInstance or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPDatabaseInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "UpdateSAPDatabaseInstanceRequest") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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 - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 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) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, sap_virtual_instance_name: str, database_instance_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes the Database resource corresponding to a Virtual Instance for SAP solutions resource. - :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. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> Iterable["_models.SAPDatabaseInstance"]: - """Lists the Database resources associated with a Virtual Instance for SAP solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :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 SAPDatabaseInstance or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPDatabaseInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPDatabaseInstanceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SAPDatabaseInstanceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - def _start_instance_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StartRequest") - else: - _json = None - - request = build_start_instance_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._start_instance_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _start_instance_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" - } - - @overload - def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[_models.StartRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Starts the database instance of the SAP system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: SAP Database server instance start request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Starts the database instance of the SAP system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: SAP Database server instance start request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_start_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Starts the database instance of the SAP system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: SAP Database server instance start request body. Is either a StartRequest type or - a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_instance_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start" - } - - def _stop_instance_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StopRequest") - else: - _json = None - - request = build_stop_instance_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - database_instance_name=database_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._stop_instance_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _stop_instance_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" - } - - @overload - def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[_models.StopRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Stops the database instance of the SAP system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Stop request for the database instance of the SAP system. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Stops the database instance of the SAP system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Stop request for the database instance of the SAP system. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_stop_instance( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - database_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Stops the database instance of the SAP system. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param database_instance_name: Database resource name string modeled as parameter for auto - generation to work correctly. Required. - :type database_instance_name: str - :param body: Stop request for the database instance of the SAP system. Is either a StopRequest - type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_instance_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop" - } diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_sap_virtual_instances_operations.py deleted file mode 100644 index 631b86fb31259..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_sap_virtual_instances_operations.py +++ /dev/null @@ -1,1663 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import WorkloadsSapVirtualInstanceMgmtClientMixinABC, _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_create_request( - resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, sap_virtual_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", pattern=r"^[a-zA-Z][a-zA-Z0-9]{2}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class SAPVirtualInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.workloadssapvirtualinstance.WorkloadsSapVirtualInstanceMgmtClient`'s - :attr:`sap_virtual_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _create_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.SAPVirtualInstance, IO]] = None, - **kwargs: Any - ) -> _models.SAPVirtualInstance: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "SAPVirtualInstance") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, 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, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" - } - - @overload - def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[_models.SAPVirtualInstance] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SAPVirtualInstance]: - """Creates a Virtual Instance for SAP solutions (VIS) resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: Virtual Instance for SAP solutions resource request body. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPVirtualInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SAPVirtualInstance]: - """Creates a Virtual Instance for SAP solutions (VIS) resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: Virtual Instance for SAP solutions resource request body. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPVirtualInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.SAPVirtualInstance, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.SAPVirtualInstance]: - """Creates a Virtual Instance for SAP solutions (VIS) resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: Virtual Instance for SAP solutions resource request body. Is either a - SAPVirtualInstance type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPVirtualInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" - } - - @distributed_trace - def get( - self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> _models.SAPVirtualInstance: - """Gets a Virtual Instance for SAP solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :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.workloadssapvirtualinstance.models.SAPVirtualInstance - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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}" - } - - def _update_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.UpdateSAPVirtualInstanceRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPVirtualInstance: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "UpdateSAPVirtualInstanceRequest") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" - } - - @overload - def begin_update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[_models.UpdateSAPVirtualInstanceRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SAPVirtualInstance]: - """Updates a Virtual Instance for SAP solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: Request body to update a Virtual Instance for SAP solutions resource. Default - value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPVirtualInstanceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPVirtualInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SAPVirtualInstance]: - """Updates a Virtual Instance for SAP solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: Request body to update a Virtual Instance for SAP solutions resource. Default - value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPVirtualInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.UpdateSAPVirtualInstanceRequest, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.SAPVirtualInstance]: - """Updates a Virtual Instance for SAP solutions resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: Request body to update a Virtual Instance for SAP solutions resource. Is either a - UpdateSAPVirtualInstanceRequest type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.UpdateSAPVirtualInstanceRequest or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either SAPVirtualInstance or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPVirtualInstance] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SAPVirtualInstance", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 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) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" - } - - @distributed_trace - def begin_delete(self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a Virtual Instance for SAP solutions resource and its child resources, that is the - associated Central Services Instance, Application Server Instances and Database Instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SAPVirtualInstance"]: - """Gets all Virtual Instances for SAP solutions resources in a Resource Group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :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 SAPVirtualInstance or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPVirtualInstanceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SAPVirtualInstanceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SAPVirtualInstance"]: - """Gets all Virtual Instances for SAP solutions resources in a Subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SAPVirtualInstance or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.workloadssapvirtualinstance.models.SAPVirtualInstance] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SAPVirtualInstanceList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SAPVirtualInstanceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - def _start_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StartRequest") - else: - _json = None - - request = build_start_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._start_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start" - } - - @overload - def begin_start( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[_models.StartRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Starts the SAP application, that is the Central Services instance and Application server - instances. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: The Virtual Instance for SAP solutions resource start request body. Default value - is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_start( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Starts the SAP application, that is the Central Services instance and Application server - instances. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: The Virtual Instance for SAP solutions resource start request body. Default value - is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_start( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.StartRequest, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Starts the SAP application, that is the Central Services instance and Application server - instances. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: The Virtual Instance for SAP solutions resource start request body. Is either a - StartRequest type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StartRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start" - } - - def _stop_initial( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> Optional[_models.OperationStatusResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StopRequest") - else: - _json = None - - request = build_stop_request( - resource_group_name=resource_group_name, - sap_virtual_instance_name=sap_virtual_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._stop_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop" - } - - @overload - def begin_stop( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[_models.StopRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Stops the SAP Application, that is the Application server instances and Central Services - instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: The Virtual Instance for SAP solutions resource stop request body. Default value - is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_stop( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Stops the SAP Application, that is the Application server instances and Central Services - instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: The Virtual Instance for SAP solutions resource stop request body. Default value - is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_stop( - self, - resource_group_name: str, - sap_virtual_instance_name: str, - body: Optional[Union[_models.StopRequest, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationStatusResult]: - """Stops the SAP Application, that is the Application server instances and Central Services - instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sap_virtual_instance_name: The name of the Virtual Instances for SAP solutions resource. - Required. - :type sap_virtual_instance_name: str - :param body: The Virtual Instance for SAP solutions resource stop request body. Is either a - StopRequest type or a IO type. Default value is None. - :type body: ~azure.mgmt.workloadssapvirtualinstance.models.StopRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationStatusResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.workloadssapvirtualinstance.models.OperationStatusResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._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, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationStatusResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop" - } diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_workloads_sap_virtual_instance_mgmt_client_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_workloads_sap_virtual_instance_mgmt_client_operations.py deleted file mode 100644 index 8af0581481edf..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/azure/mgmt/workloadssapvirtualinstance/operations/_workloads_sap_virtual_instance_mgmt_client_operations.py +++ /dev/null @@ -1,707 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import WorkloadsSapVirtualInstanceMgmtClientMixinABC, _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_sap_sizing_recommendations_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_sap_supported_sku_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_sap_disk_configurations_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_sap_availability_zone_details_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class WorkloadsSapVirtualInstanceMgmtClientOperationsMixin(WorkloadsSapVirtualInstanceMgmtClientMixinABC): - @overload - def sap_sizing_recommendations( - self, - location: str, - sap_sizing_recommendation: Optional[_models.SAPSizingRecommendationRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPSizingRecommendationResult: - """Get SAP sizing recommendations by providing input SAPS for application tier and memory required - for database tier. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is - None. - :type sap_sizing_recommendation: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPSizingRecommendationResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def sap_sizing_recommendations( - self, - location: str, - sap_sizing_recommendation: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPSizingRecommendationResult: - """Get SAP sizing recommendations by providing input SAPS for application tier and memory required - for database tier. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is - None. - :type sap_sizing_recommendation: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPSizingRecommendationResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def sap_sizing_recommendations( - self, - location: str, - sap_sizing_recommendation: Optional[Union[_models.SAPSizingRecommendationRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPSizingRecommendationResult: - """Get SAP sizing recommendations by providing input SAPS for application tier and memory required - for database tier. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Is either a - SAPSizingRecommendationRequest type or a IO type. Default value is None. - :type sap_sizing_recommendation: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPSizingRecommendationResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSizingRecommendationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPSizingRecommendationResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(sap_sizing_recommendation, (IOBase, bytes)): - _content = sap_sizing_recommendation - else: - if sap_sizing_recommendation is not None: - _json = self._serialize.body(sap_sizing_recommendation, "SAPSizingRecommendationRequest") - else: - _json = None - - request = build_sap_sizing_recommendations_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.sap_sizing_recommendations.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - @overload - def sap_supported_sku( - self, - location: str, - sap_supported_sku: Optional[_models.SAPSupportedSkusRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPSupportedResourceSkusResult: - """Get a list of SAP supported SKUs for ASCS, Application and Database tier. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_supported_sku: SAP Supported SKU Request body. Default value is None. - :type sap_supported_sku: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedSkusRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPSupportedResourceSkusResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def sap_supported_sku( - self, - location: str, - sap_supported_sku: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPSupportedResourceSkusResult: - """Get a list of SAP supported SKUs for ASCS, Application and Database tier. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_supported_sku: SAP Supported SKU Request body. Default value is None. - :type sap_supported_sku: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPSupportedResourceSkusResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def sap_supported_sku( - self, - location: str, - sap_supported_sku: Optional[Union[_models.SAPSupportedSkusRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPSupportedResourceSkusResult: - """Get a list of SAP supported SKUs for ASCS, Application and Database tier. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_supported_sku: SAP Supported SKU Request body. Is either a SAPSupportedSkusRequest - type or a IO type. Default value is None. - :type sap_supported_sku: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedSkusRequest - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPSupportedResourceSkusResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPSupportedResourceSkusResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPSupportedResourceSkusResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(sap_supported_sku, (IOBase, bytes)): - _content = sap_supported_sku - else: - if sap_supported_sku is not None: - _json = self._serialize.body(sap_supported_sku, "SAPSupportedSkusRequest") - else: - _json = None - - request = build_sap_supported_sku_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.sap_supported_sku.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - @overload - def sap_disk_configurations( - self, - location: str, - sap_disk_configurations: Optional[_models.SAPDiskConfigurationsRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPDiskConfigurationsResult: - """Get the SAP Disk Configuration Layout prod/non-prod SAP System. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_disk_configurations: SAP Disk Configurations Request body. Default value is None. - :type sap_disk_configurations: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPDiskConfigurationsResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def sap_disk_configurations( - self, - location: str, - sap_disk_configurations: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPDiskConfigurationsResult: - """Get the SAP Disk Configuration Layout prod/non-prod SAP System. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_disk_configurations: SAP Disk Configurations Request body. Default value is None. - :type sap_disk_configurations: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPDiskConfigurationsResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def sap_disk_configurations( - self, - location: str, - sap_disk_configurations: Optional[Union[_models.SAPDiskConfigurationsRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPDiskConfigurationsResult: - """Get the SAP Disk Configuration Layout prod/non-prod SAP System. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_disk_configurations: SAP Disk Configurations Request body. Is either a - SAPDiskConfigurationsRequest type or a IO type. Default value is None. - :type sap_disk_configurations: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPDiskConfigurationsResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPDiskConfigurationsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPDiskConfigurationsResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(sap_disk_configurations, (IOBase, bytes)): - _content = sap_disk_configurations - else: - if sap_disk_configurations is not None: - _json = self._serialize.body(sap_disk_configurations, "SAPDiskConfigurationsRequest") - else: - _json = None - - request = build_sap_disk_configurations_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.sap_disk_configurations.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } - - @overload - def sap_availability_zone_details( - self, - location: str, - sap_availability_zone_details: Optional[_models.SAPAvailabilityZoneDetailsRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPAvailabilityZoneDetailsResult: - """Get the recommended SAP Availability Zone Pair Details for your region. - - :param location: The name of Azure region. Required. - :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.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPAvailabilityZoneDetailsResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def sap_availability_zone_details( - self, - location: str, - sap_availability_zone_details: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SAPAvailabilityZoneDetailsResult: - """Get the recommended SAP Availability Zone Pair Details for your region. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_availability_zone_details: SAP Availability Zone Details Request body. Default value - is None. - :type sap_availability_zone_details: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPAvailabilityZoneDetailsResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def sap_availability_zone_details( - self, - location: str, - sap_availability_zone_details: Optional[Union[_models.SAPAvailabilityZoneDetailsRequest, IO]] = None, - **kwargs: Any - ) -> _models.SAPAvailabilityZoneDetailsResult: - """Get the recommended SAP Availability Zone Pair Details for your region. - - :param location: The name of Azure region. Required. - :type location: str - :param sap_availability_zone_details: SAP Availability Zone Details Request body. Is either a - SAPAvailabilityZoneDetailsRequest type or a IO type. Default value is None. - :type sap_availability_zone_details: - ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SAPAvailabilityZoneDetailsResult or the result of cls(response) - :rtype: ~azure.mgmt.workloadssapvirtualinstance.models.SAPAvailabilityZoneDetailsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SAPAvailabilityZoneDetailsResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(sap_availability_zone_details, (IOBase, bytes)): - _content = sap_availability_zone_details - else: - 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( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.sap_availability_zone_details.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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" - } diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/operations_list.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/operations_list.py index c80f0ee6e9dd4..ac958fae03936 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/operations_list.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/operations_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/operations/preview/2023-10-01-preview/examples/Operations_List.json +# x-ms-original-file: 2024-09-01/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_create.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_create.py index 15ddf7e6db741..230a0fb32ebf0 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_create.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,17 +27,18 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_application_server_instances.begin_create( resource_group_name="test-rg", sap_virtual_instance_name="X00", application_instance_name="app01", + resource={"location": "westcentralus", "properties": {}, "tags": {}}, ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Create.json +# x-ms-original-file: 2024-09-01/SapApplicationServerInstances_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_create_for_ha_with_availability_set.py similarity index 77% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create_ha_av_set.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_create_for_ha_with_availability_set.py index f34ce4b2fad80..4f78a2a9352e3 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_create_ha_av_set.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_create_for_ha_with_availability_set.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_application_server_instances_create_ha_av_set.py + python sap_application_server_instances_create_for_ha_with_availability_set.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +27,18 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_application_server_instances.begin_create( resource_group_name="test-rg", sap_virtual_instance_name="X00", application_instance_name="app01", + resource={"location": "westcentralus", "properties": {}, "tags": {}}, ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Create_HA_AvSet.json +# x-ms-original-file: 2024-09-01/SapApplicationServerInstances_CreateForHaWithAvailabilitySet.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_delete.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_delete.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_delete.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_delete.py index 354f303385db5..d02f62c6ef854 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_delete.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_delete.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) client.sap_application_server_instances.begin_delete( @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Delete.json +# x-ms-original-file: 2024-09-01/SapApplicationServerInstances_Delete.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_get.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_get.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_get.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_get.py index 91157a782cdcb..d24e284e825c1 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_application_server_instances.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Get.json +# x-ms-original-file: 2024-09-01/SapApplicationServerInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_list.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_list_by_sap_virtual_instance.py similarity index 78% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_list.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_list_by_sap_virtual_instance.py index a575dc6cfedd8..a9cfe155d0d9e 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_list.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_list_by_sap_virtual_instance.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_application_server_instances_list.py + python sap_application_server_instances_list_by_sap_virtual_instance.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_application_server_instances.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_List.json +# x-ms-original-file: 2024-09-01/SapApplicationServerInstances_ListBySapVirtualInstance.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_start_instance.py similarity index 80% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_start_instance.py index d30a71c515184..abe4285cdbc62 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_start_instance.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,10 +27,10 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_application_server_instances.begin_start_instance( + response = client.sap_application_server_instances.begin_start( resource_group_name="test-rg", sap_virtual_instance_name="X00", application_instance_name="app01", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StartInstance.json +# x-ms-original-file: 2024-09-01/SapApplicationServerInstances_StartInstance.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_start_instance_vm.py similarity index 75% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance_with_infra_operations.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_start_instance_vm.py index 0631e31f96c75..225a3c2ac65de 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_start_instance_with_infra_operations.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_start_instance_vm.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_application_server_instances_start_instance_with_infra_operations.py + python sap_application_server_instances_start_instance_vm.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,10 +27,10 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_application_server_instances.begin_start_instance( + response = client.sap_application_server_instances.begin_start( resource_group_name="test-rg", sap_virtual_instance_name="X00", application_instance_name="app01", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StartInstance_WithInfraOperations.json +# x-ms-original-file: 2024-09-01/SapApplicationServerInstances_StartInstanceVM.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_stop_instance.py similarity index 80% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_stop_instance.py index a347b5bdf9b7d..d8ba2034e5f1b 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_stop_instance.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,10 +27,10 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_application_server_instances.begin_stop_instance( + response = client.sap_application_server_instances.begin_stop( resource_group_name="test-rg", sap_virtual_instance_name="X00", application_instance_name="app01", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StopInstance.json +# x-ms-original-file: 2024-09-01/SapApplicationServerInstances_StopInstance.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_stop_instance_infrastructure.py similarity index 75% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance_with_infra_operations.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_stop_instance_infrastructure.py index 9f04b823b6066..1afe4140e0c64 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_stop_instance_with_infra_operations.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_stop_instance_infrastructure.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_application_server_instances_stop_instance_with_infra_operations.py + python sap_application_server_instances_stop_instance_infrastructure.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,10 +27,10 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_application_server_instances.begin_stop_instance( + response = client.sap_application_server_instances.begin_stop( resource_group_name="test-rg", sap_virtual_instance_name="X00", application_instance_name="app01", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_StopInstance_WithInfraOperations.json +# x-ms-original-file: 2024-09-01/SapApplicationServerInstances_StopInstanceInfrastructure.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_stop_instance_soft.py similarity index 75% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_stop_instance_soft.py index 50f01b781bba9..269147c5e4924 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_stop_instance_soft.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_virtual_instances_create_discover.py + python sap_application_server_instances_stop_instance_soft.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,17 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_virtual_instances.begin_create( + response = client.sap_application_server_instances.begin_stop( resource_group_name="test-rg", sap_virtual_instance_name="X00", + application_instance_name="app01", ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover.json +# x-ms-original-file: 2024-09-01/SapApplicationServerInstances_StopInstanceSoft.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_stop_instance_soft_infrastructure.py similarity index 75% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_set.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_stop_instance_soft_infrastructure.py index b494a66ad7496..9a489a274cb97 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_set.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_stop_instance_soft_infrastructure.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_virtual_instances_create_ha_av_set.py + python sap_application_server_instances_stop_instance_soft_infrastructure.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,17 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_virtual_instances.begin_create( + response = client.sap_application_server_instances.begin_stop( resource_group_name="test-rg", sap_virtual_instance_name="X00", + application_instance_name="app01", ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvSet.json +# x-ms-original-file: 2024-09-01/SapApplicationServerInstances_StopInstanceSoftInfrastructure.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_update.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_update.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_update.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_update.py index 033e31df49ffd..47e07848909a0 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapapplicationinstances/sap_application_server_instances_update.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_application_server_instances_update.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,17 +27,18 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_application_server_instances.update( resource_group_name="test-rg", sap_virtual_instance_name="X00", application_instance_name="app01", + properties={"tags": {"tag1": "value1"}}, ) print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapapplicationinstances/SAPApplicationServerInstances_Update.json +# x-ms-original-file: 2024-09-01/SapApplicationServerInstances_Update.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_create.py similarity index 78% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_create.py index 90499518bccc2..66e219fdc2dc4 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_create.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,17 +27,18 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_central_instances.begin_create( + response = client.sap_central_server_instances.begin_create( resource_group_name="test-rg", sap_virtual_instance_name="X00", central_instance_name="centralServer", + resource={"location": "westcentralus", "properties": {}, "tags": {}}, ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Create.json +# x-ms-original-file: 2024-09-01/SapCentralInstances_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_create_for_ha_with_availability_set.py similarity index 75% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create_ha_av_set.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_create_for_ha_with_availability_set.py index 9ed5ae5568d71..250a1c49c9d3f 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_create_ha_av_set.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_create_for_ha_with_availability_set.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_central_instances_create_ha_av_set.py + python sap_central_instances_create_for_ha_with_availability_set.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +27,18 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_central_instances.begin_create( + response = client.sap_central_server_instances.begin_create( resource_group_name="test-rg", sap_virtual_instance_name="X00", central_instance_name="centralServer", + resource={"location": "westcentralus", "properties": {}, "tags": {}}, ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Create_HA_AvSet.json +# x-ms-original-file: 2024-09-01/SapCentralInstances_CreateForHaWithAvailabilitySet.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_delete.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_delete.py similarity index 79% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_delete.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_delete.py index 60cb668988e50..90aa2a3247449 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_delete.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_delete.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,16 +27,16 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) - client.sap_central_instances.begin_delete( + client.sap_central_server_instances.begin_delete( resource_group_name="test-rg", sap_virtual_instance_name="X00", central_instance_name="centralServer", ).result() -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Delete.json +# x-ms-original-file: 2024-09-01/SapCentralInstances_Delete.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_get.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_get.py similarity index 79% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_get.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_get.py index d8b68926ca1d2..1c49f04642ce3 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,10 +27,10 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_central_instances.get( + response = client.sap_central_server_instances.get( resource_group_name="test-rg", sap_virtual_instance_name="X00", central_instance_name="centralServer", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Get.json +# x-ms-original-file: 2024-09-01/SapCentralInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_start_instance.py similarity index 78% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_start_instance.py index 57516ff62f669..f5389d448f6dd 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_start_instance.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,10 +27,10 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_central_instances.begin_start_instance( + response = client.sap_central_server_instances.begin_start( resource_group_name="test-rg", sap_virtual_instance_name="X00", central_instance_name="centralServer", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StartInstance.json +# x-ms-original-file: 2024-09-01/SapCentralInstances_StartInstance.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_start_instance_vm.py similarity index 74% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_zone.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_start_instance_vm.py index 5da534a9d218e..4c19c013583af 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_zone.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_start_instance_vm.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_virtual_instances_create_ha_av_zone.py + python sap_central_instances_start_instance_vm.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,17 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_virtual_instances.begin_create( + response = client.sap_central_server_instances.begin_start( resource_group_name="test-rg", sap_virtual_instance_name="X00", + central_instance_name="centralServer", ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvZone.json +# x-ms-original-file: 2024-09-01/SapCentralInstances_StartInstanceVM.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_stop_instance.py similarity index 78% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_stop_instance.py index 11db11e00931c..4848f2b6ef793 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_stop_instance.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,10 +27,10 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_central_instances.begin_stop_instance( + response = client.sap_central_server_instances.begin_stop( resource_group_name="test-rg", sap_virtual_instance_name="X00", central_instance_name="centralServer", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StopInstance.json +# x-ms-original-file: 2024-09-01/SapCentralInstances_StopInstance.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_stop_instance_vm.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_stop_instance_vm.py new file mode 100644 index 0000000000000..171fbd0eadc65 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_stop_instance_vm.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_central_instances_stop_instance_vm.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_central_server_instances.begin_stop( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + central_instance_name="centralServer", + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapCentralInstances_StopInstanceVM.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_update.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_update.py similarity index 79% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_update.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_update.py index 6bec3b0dbafc3..3f5335dcb0274 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_update.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_instances_update.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,17 +27,18 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_central_instances.update( + response = client.sap_central_server_instances.update( resource_group_name="test-rg", sap_virtual_instance_name="X00", central_instance_name="centralServer", + properties={"tags": {"tag1": "value1"}}, ) print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_Update.json +# x-ms-original-file: 2024-09-01/SapCentralInstances_Update.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_list.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_server_instances_list_by_sap_virtual_instance.py similarity index 76% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_list.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_server_instances_list_by_sap_virtual_instance.py index d648b279bc307..19e784d954a95 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_list.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_central_server_instances_list_by_sap_virtual_instance.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_central_instances_list.py + python sap_central_server_instances_list_by_sap_virtual_instance.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,10 +27,10 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_central_instances.list( + response = client.sap_central_server_instances.list( resource_group_name="test-rg", sap_virtual_instance_name="X00", ) @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_List.json +# x-ms-original-file: 2024-09-01/SapCentralServerInstances_ListBySapVirtualInstance.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_create.py similarity index 82% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_create.py index 4d478913a304b..a6f1b5b7b69bc 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_create.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,17 +27,18 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_database_instances.begin_create( resource_group_name="test-rg", sap_virtual_instance_name="X00", database_instance_name="databaseServer", + resource={"location": "westcentralus", "properties": {}, "tags": {}}, ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Create.json +# x-ms-original-file: 2024-09-01/SapDatabaseInstances_Create.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_create_for_ha_with_availability_set.py similarity index 78% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create_ha_av_set.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_create_for_ha_with_availability_set.py index ac22401ab8459..9303c531eb270 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_create_ha_av_set.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_create_for_ha_with_availability_set.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_database_instances_create_ha_av_set.py + python sap_database_instances_create_for_ha_with_availability_set.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,17 +27,18 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_database_instances.begin_create( resource_group_name="test-rg", sap_virtual_instance_name="X00", database_instance_name="databaseServer", + resource={"location": "westcentralus", "properties": {}, "tags": {}}, ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Create_HA_AvSet.json +# x-ms-original-file: 2024-09-01/SapDatabaseInstances_CreateForHaWithAvailabilitySet.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_delete.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_delete.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_delete.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_delete.py index d996da3c3b0ae..08d58719b36a3 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_delete.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_delete.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) client.sap_database_instances.begin_delete( @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Delete.json +# x-ms-original-file: 2024-09-01/SapDatabaseInstances_Delete.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_get.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_get.py similarity index 82% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_get.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_get.py index bb77848264c62..7dc8f9d7209fa 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_database_instances.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Get.json +# x-ms-original-file: 2024-09-01/SapDatabaseInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_list.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_list.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_list.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_list.py index d04be8e706247..1fff883e7404e 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_list.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_list.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_database_instances.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_List.json +# x-ms-original-file: 2024-09-01/SapDatabaseInstances_List.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_start_instance.py similarity index 78% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_start_instance.py index 4ac66a4adc63f..b23beea112b16 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_start_instance.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,10 +27,10 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_database_instances.begin_start_instance( + response = client.sap_database_instances.begin_start( resource_group_name="test-rg", sap_virtual_instance_name="X00", database_instance_name="db0", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StartInstance.json +# x-ms-original-file: 2024-09-01/SapDatabaseInstances_StartInstance.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_start_instance_vm.py similarity index 74% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_start_instance_vm.py index 2ee3424fa46a4..d39dc43f70431 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_start_instance_vm.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_virtual_instances_create_distributed.py + python sap_database_instances_start_instance_vm.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,17 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_virtual_instances.begin_create( + response = client.sap_database_instances.begin_start( resource_group_name="test-rg", sap_virtual_instance_name="X00", + database_instance_name="db0", ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed.json +# x-ms-original-file: 2024-09-01/SapDatabaseInstances_StartInstanceVM.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_stop_instance.py similarity index 78% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_stop_instance.py index aad810a05694d..afe9e85f240ae 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_stop_instance.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,10 +27,10 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_database_instances.begin_stop_instance( + response = client.sap_database_instances.begin_stop( resource_group_name="test-rg", sap_virtual_instance_name="X00", database_instance_name="db0", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StopInstance.json +# x-ms-original-file: 2024-09-01/SapDatabaseInstances_StopInstance.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_stop_instance_soft.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_stop_instance_soft.py new file mode 100644 index 0000000000000..9b9228b0ca244 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_stop_instance_soft.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_database_instances_stop_instance_soft.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_database_instances.begin_stop( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="db0", + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapDatabaseInstances_StopInstanceSoft.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_stop_instance_soft_vm.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_stop_instance_soft_vm.py new file mode 100644 index 0000000000000..085e04032551e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_stop_instance_soft_vm.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_database_instances_stop_instance_soft_vm.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_database_instances.begin_stop( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="db0", + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapDatabaseInstances_StopInstanceSoftVM.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_stop_instance_vm.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_stop_instance_vm.py new file mode 100644 index 0000000000000..75972478f8bf3 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_stop_instance_vm.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_database_instances_stop_instance_vm.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_database_instances.begin_stop( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + database_instance_name="db0", + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapDatabaseInstances_StopInstanceVM.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_update.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_update.py similarity index 82% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_update.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_update.py index 348c53a9d5f1f..acaf7e01e1b19 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_update.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_database_instances_update.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,17 +27,18 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_database_instances.update( resource_group_name="test-rg", sap_virtual_instance_name="X00", database_instance_name="databaseServer", + properties={"tags": {"key1": "value1"}}, ) print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_Update.json +# x-ms-original-file: 2024-09-01/SapDatabaseInstances_Update.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_detect_ds.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_detect_ds.py new file mode 100644 index 0000000000000..ee7d7b399fe55 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_detect_ds.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_detect_ds.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "eastus2", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "{{resourcegrp}}", + "applicationServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "azureuser", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "{{privateKey}}", "publicKey": "{{sshkey}}"}, + }, + }, + "vmSize": "Standard_E4ds_v4", + }, + }, + "centralServer": { + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "azureuser", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "{{privateKey}}", "publicKey": "{{sshkey}}"}, + }, + }, + "vmSize": "Standard_E4ds_v4", + }, + }, + "databaseServer": { + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "azureuser", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "{{privateKey}}", "publicKey": "{{sshkey}}"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "networkConfiguration": {"isSecondaryIpEnabled": True}, + }, + "osSapConfiguration": {"sapFqdn": "sap.bpaas.com"}, + "softwareConfiguration": { + "centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0", + "softwareInstallationType": "External", + }, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {"created by": "azureuser"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateDetectDS.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_detect_ha_availability_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_detect_ha_availability_set.py new file mode 100644 index 0000000000000..e90f7a69ce626 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_detect_ha_availability_set.py @@ -0,0 +1,128 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_detect_ha_availability_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "highAvailabilityConfig": {"highAvailabilityType": "AvailabilitySet"}, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + "softwareConfiguration": { + "centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0", + "softwareInstallationType": "External", + }, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateDetectHaAvailabilitySet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_detect_ha_availability_zone.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_detect_ha_availability_zone.py new file mode 100644 index 0000000000000..aa30815f1e1d1 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_detect_ha_availability_zone.py @@ -0,0 +1,128 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_detect_ha_availability_zone.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "highAvailabilityConfig": {"highAvailabilityType": "AvailabilityZone"}, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + "softwareConfiguration": { + "centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0", + "softwareInstallationType": "External", + }, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateDetectHaAvailabilityZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_detect_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_detect_single_server.py new file mode 100644 index 0000000000000..5051541daa5b9 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_detect_single_server.py @@ -0,0 +1,83 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_detect_single_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "databaseType": "HANA", + "deploymentType": "SingleServer", + "networkConfiguration": {"isSecondaryIpEnabled": True}, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + "softwareConfiguration": { + "centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0", + "softwareInstallationType": "External", + }, + }, + "environment": "NonProd", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateDetectSingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_disk_os_ds_recommended.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_disk_os_ds_recommended.py new file mode 100644 index 0000000000000..2cac2f9ac7887 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_disk_os_ds_recommended.py @@ -0,0 +1,133 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_disk_os_ds_recommended.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "diskConfiguration": { + "diskVolumeConfigurations": { + "backup": {"count": 2, "sizeGB": 256, "sku": {"name": "StandardSSD_LRS"}}, + "hana/data": {"count": 4, "sizeGB": 128, "sku": {"name": "Premium_LRS"}}, + "hana/log": {"count": 3, "sizeGB": 128, "sku": {"name": "Premium_LRS"}}, + "hana/shared": {"count": 1, "sizeGB": 256, "sku": {"name": "StandardSSD_LRS"}}, + "os": {"count": 1, "sizeGB": 64, "sku": {"name": "StandardSSD_LRS"}}, + "usr/sap": {"count": 1, "sizeGB": 128, "sku": {"name": "Premium_LRS"}}, + } + }, + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraDiskOsDSRecommended.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_disk_os_ha_availability_set_recommended.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_disk_os_ha_availability_set_recommended.py new file mode 100644 index 0000000000000..9a0e34c8563d1 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_disk_os_ha_availability_set_recommended.py @@ -0,0 +1,134 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_disk_os_ha_availability_set_recommended.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "diskConfiguration": { + "diskVolumeConfigurations": { + "backup": {"count": 2, "sizeGB": 256, "sku": {"name": "StandardSSD_LRS"}}, + "hana/data": {"count": 4, "sizeGB": 128, "sku": {"name": "Premium_LRS"}}, + "hana/log": {"count": 3, "sizeGB": 128, "sku": {"name": "Premium_LRS"}}, + "hana/shared": {"count": 1, "sizeGB": 256, "sku": {"name": "StandardSSD_LRS"}}, + "os": {"count": 1, "sizeGB": 64, "sku": {"name": "StandardSSD_LRS"}}, + "usr/sap": {"count": 1, "sizeGB": 128, "sku": {"name": "Premium_LRS"}}, + } + }, + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "highAvailabilityConfig": {"highAvailabilityType": "AvailabilitySet"}, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraDiskOsHaAvailabilitySetRecommended.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_disk_os_ha_availability_zone_recommended.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_disk_os_ha_availability_zone_recommended.py new file mode 100644 index 0000000000000..6cd83f41b9205 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_disk_os_ha_availability_zone_recommended.py @@ -0,0 +1,134 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_disk_os_ha_availability_zone_recommended.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "diskConfiguration": { + "diskVolumeConfigurations": { + "backup": {"count": 2, "sizeGB": 256, "sku": {"name": "StandardSSD_LRS"}}, + "hana/data": {"count": 4, "sizeGB": 128, "sku": {"name": "Premium_LRS"}}, + "hana/log": {"count": 3, "sizeGB": 128, "sku": {"name": "Premium_LRS"}}, + "hana/shared": {"count": 1, "sizeGB": 256, "sku": {"name": "StandardSSD_LRS"}}, + "os": {"count": 1, "sizeGB": 64, "sku": {"name": "StandardSSD_LRS"}}, + "usr/sap": {"count": 1, "sizeGB": 128, "sku": {"name": "Premium_LRS"}}, + } + }, + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "highAvailabilityConfig": {"highAvailabilityType": "AvailabilityZone"}, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraDiskOsHaAvailabilityZoneRecommended.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_disk_os_single_server_recommended.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_disk_os_single_server_recommended.py new file mode 100644 index 0000000000000..f8e87d3e72349 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_disk_os_single_server_recommended.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_disk_os_single_server_recommended.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "databaseType": "HANA", + "dbDiskConfiguration": { + "diskVolumeConfigurations": { + "backup": {"count": 2, "sizeGB": 256, "sku": {"name": "StandardSSD_LRS"}}, + "hana/data": {"count": 4, "sizeGB": 128, "sku": {"name": "Premium_LRS"}}, + "hana/log": {"count": 3, "sizeGB": 128, "sku": {"name": "Premium_LRS"}}, + "hana/shared": {"count": 1, "sizeGB": 256, "sku": {"name": "StandardSSD_LRS"}}, + "os": {"count": 1, "sizeGB": 64, "sku": {"name": "StandardSSD_LRS"}}, + "usr/sap": {"count": 1, "sizeGB": 128, "sku": {"name": "Premium_LRS"}}, + } + }, + "deploymentType": "SingleServer", + "networkConfiguration": {"isSecondaryIpEnabled": True}, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "NonProd", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraDiskOsSingleServerRecommended.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_ds.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_ds.py new file mode 100644 index 0000000000000..6438adbc9b425 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_ds.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_ds.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "Deployment", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + }, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraDS.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_ha_availability_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_ha_availability_set.py new file mode 100644 index 0000000000000..57269c91b83dd --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_ha_availability_set.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_ha_availability_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "Deployment", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 5, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "highAvailabilityConfig": {"highAvailabilityType": "AvailabilitySet"}, + }, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraHaAvailabilitySet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_ha_availability_zone.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_ha_availability_zone.py new file mode 100644 index 0000000000000..de01942d56fd9 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_ha_availability_zone.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_ha_availability_zone.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "Deployment", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "highAvailabilityConfig": {"highAvailabilityType": "AvailabilityZone"}, + }, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraHaAvailabilityZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_compute_gallery_image.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_compute_gallery_image.py new file mode 100644 index 0000000000000..96270b05c1af3 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_compute_gallery_image.py @@ -0,0 +1,114 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_os_compute_gallery_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "Deployment", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "id": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1" + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "id": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1" + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "id": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/galleries/testgallery/images/rhelimagetest/versions/0.0.1" + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "highAvailabilityConfig": {"highAvailabilityType": "AvailabilityZone"}, + }, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraOsComputeGalleryImage.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_custom_resource_names_ds.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_custom_resource_names_ds.py new file mode 100644 index 0000000000000..27a3792bb3f52 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_custom_resource_names_ds.py @@ -0,0 +1,176 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_os_custom_resource_names_ds.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "customResourceNames": { + "applicationServer": { + "availabilitySetName": "appAvSet", + "virtualMachines": [ + { + "dataDiskNames": {"default": ["app0disk0"]}, + "hostName": "apphostName0", + "networkInterfaces": [{"networkInterfaceName": "appnic0"}], + "osDiskName": "app0osdisk", + "vmName": "appvm0", + }, + { + "dataDiskNames": {"default": ["app1disk0"]}, + "hostName": "apphostName1", + "networkInterfaces": [{"networkInterfaceName": "appnic1"}], + "osDiskName": "app1osdisk", + "vmName": "appvm1", + }, + ], + }, + "centralServer": { + "virtualMachines": [ + { + "dataDiskNames": {"default": ["ascsdisk0"]}, + "hostName": "ascshostName", + "networkInterfaces": [{"networkInterfaceName": "ascsnic"}], + "osDiskName": "ascsosdisk", + "vmName": "ascsvm", + } + ] + }, + "databaseServer": { + "virtualMachines": [ + { + "dataDiskNames": { + "hanaData": ["hanadata0", "hanadata1"], + "hanaLog": ["hanalog0", "hanalog1", "hanalog2"], + "hanaShared": ["hanashared0", "hanashared1"], + "usrSap": ["usrsap0"], + }, + "hostName": "dbhostName", + "networkInterfaces": [{"networkInterfaceName": "dbnic"}], + "osDiskName": "dbosdisk", + "vmName": "dbvm", + } + ] + }, + "namingPatternType": "FullResourceName", + "sharedStorage": { + "sharedStorageAccountName": "storageacc", + "sharedStorageAccountPrivateEndPointName": "peForxNFS", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraOsCustomResourceNamesDS.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_custom_resource_names_ha_availability_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_custom_resource_names_ha_availability_set.py new file mode 100644 index 0000000000000..af99228429d56 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_custom_resource_names_ha_availability_set.py @@ -0,0 +1,208 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_os_custom_resource_names_ha_availability_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "customResourceNames": { + "applicationServer": { + "availabilitySetName": "appAvSet", + "virtualMachines": [ + { + "dataDiskNames": {"default": ["app0disk0"]}, + "hostName": "apphostName0", + "networkInterfaces": [{"networkInterfaceName": "appnic0"}], + "osDiskName": "app0osdisk", + "vmName": "appvm0", + }, + { + "dataDiskNames": {"default": ["app1disk0"]}, + "hostName": "apphostName1", + "networkInterfaces": [{"networkInterfaceName": "appnic1"}], + "osDiskName": "app1osdisk", + "vmName": "appvm1", + }, + ], + }, + "centralServer": { + "availabilitySetName": "csAvSet", + "loadBalancer": { + "backendPoolNames": ["ascsBackendPool"], + "frontendIpConfigurationNames": ["ascsip0", "ersip0"], + "healthProbeNames": ["ascsHealthProbe", "ersHealthProbe"], + "loadBalancerName": "ascslb", + }, + "virtualMachines": [ + { + "hostName": "ascshostName", + "networkInterfaces": [{"networkInterfaceName": "ascsnic"}], + "osDiskName": "ascsosdisk", + "vmName": "ascsvm", + }, + { + "hostName": "ershostName", + "networkInterfaces": [{"networkInterfaceName": "ersnic"}], + "osDiskName": "ersosdisk", + "vmName": "ersvm", + }, + ], + }, + "databaseServer": { + "availabilitySetName": "dbAvSet", + "loadBalancer": { + "backendPoolNames": ["dbBackendPool"], + "frontendIpConfigurationNames": ["dbip"], + "healthProbeNames": ["dbHealthProbe"], + "loadBalancerName": "dblb", + }, + "virtualMachines": [ + { + "dataDiskNames": { + "hanaData": ["hanadatapr0", "hanadatapr1"], + "hanaLog": ["hanalogpr0", "hanalogpr1", "hanalogpr2"], + "hanaShared": ["hanasharedpr0", "hanasharedpr1"], + "usrSap": ["usrsappr0"], + }, + "hostName": "dbprhostName", + "networkInterfaces": [{"networkInterfaceName": "dbprnic"}], + "osDiskName": "dbprosdisk", + "vmName": "dbvmpr", + }, + { + "dataDiskNames": { + "hanaData": ["hanadatasr0", "hanadatasr1"], + "hanaLog": ["hanalogsr0", "hanalogsr1", "hanalogsr2"], + "hanaShared": ["hanasharedsr0", "hanasharedsr1"], + "usrSap": ["usrsapsr0"], + }, + "hostName": "dbsrhostName", + "networkInterfaces": [{"networkInterfaceName": "dbsrnic"}], + "osDiskName": "dbsrosdisk", + "vmName": "dbvmsr", + }, + ], + }, + "namingPatternType": "FullResourceName", + "sharedStorage": { + "sharedStorageAccountName": "storageacc", + "sharedStorageAccountPrivateEndPointName": "peForxNFS", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "highAvailabilityConfig": {"highAvailabilityType": "AvailabilitySet"}, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraOsCustomResourceNamesHaAvailabilitySet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_custom_resource_names_ha_availability_zone.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_custom_resource_names_ha_availability_zone.py new file mode 100644 index 0000000000000..f2c5225d8d001 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_custom_resource_names_ha_availability_zone.py @@ -0,0 +1,205 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_os_custom_resource_names_ha_availability_zone.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "customResourceNames": { + "applicationServer": { + "virtualMachines": [ + { + "dataDiskNames": {"default": ["app0disk0"]}, + "hostName": "apphostName0", + "networkInterfaces": [{"networkInterfaceName": "appnic0"}], + "osDiskName": "app0osdisk", + "vmName": "appvm0", + }, + { + "dataDiskNames": {"default": ["app1disk0"]}, + "hostName": "apphostName1", + "networkInterfaces": [{"networkInterfaceName": "appnic1"}], + "osDiskName": "app1osdisk", + "vmName": "appvm1", + }, + ] + }, + "centralServer": { + "loadBalancer": { + "backendPoolNames": ["ascsBackendPool"], + "frontendIpConfigurationNames": ["ascsip0", "ersip0"], + "healthProbeNames": ["ascsHealthProbe", "ersHealthProbe"], + "loadBalancerName": "ascslb", + }, + "virtualMachines": [ + { + "hostName": "ascshostName", + "networkInterfaces": [{"networkInterfaceName": "ascsnic"}], + "osDiskName": "ascsosdisk", + "vmName": "ascsvm", + }, + { + "hostName": "ershostName", + "networkInterfaces": [{"networkInterfaceName": "ersnic"}], + "osDiskName": "ersosdisk", + "vmName": "ersvm", + }, + ], + }, + "databaseServer": { + "loadBalancer": { + "backendPoolNames": ["dbBackendPool"], + "frontendIpConfigurationNames": ["dbip"], + "healthProbeNames": ["dbHealthProbe"], + "loadBalancerName": "dblb", + }, + "virtualMachines": [ + { + "dataDiskNames": { + "hanaData": ["hanadatapr0", "hanadatapr1"], + "hanaLog": ["hanalogpr0", "hanalogpr1", "hanalogpr2"], + "hanaShared": ["hanasharedpr0", "hanasharedpr1"], + "usrSap": ["usrsappr0"], + }, + "hostName": "dbprhostName", + "networkInterfaces": [{"networkInterfaceName": "dbprnic"}], + "osDiskName": "dbprosdisk", + "vmName": "dbvmpr", + }, + { + "dataDiskNames": { + "hanaData": ["hanadatasr0", "hanadatasr1"], + "hanaLog": ["hanalogsr0", "hanalogsr1", "hanalogsr2"], + "hanaShared": ["hanasharedsr0", "hanasharedsr1"], + "usrSap": ["usrsapsr0"], + }, + "hostName": "dbsrhostName", + "networkInterfaces": [{"networkInterfaceName": "dbsrnic"}], + "osDiskName": "dbsrosdisk", + "vmName": "dbvmsr", + }, + ], + }, + "namingPatternType": "FullResourceName", + "sharedStorage": { + "sharedStorageAccountName": "storageacc", + "sharedStorageAccountPrivateEndPointName": "peForxNFS", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "highAvailabilityConfig": {"highAvailabilityType": "AvailabilityZone"}, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraOsCustomResourceNamesHaAvailabilityZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_custom_resource_names_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_custom_resource_names_single_server.py new file mode 100644 index 0000000000000..56b5f5f43833a --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_custom_resource_names_single_server.py @@ -0,0 +1,79 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_os_custom_resource_names_single_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "databaseType": "HANA", + "deploymentType": "SingleServer", + "networkConfiguration": {"isSecondaryIpEnabled": True}, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "NonProd", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraOsCustomResourceNamesSingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_ds_recommended.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_ds_recommended.py new file mode 100644 index 0000000000000..24fe90df268ea --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_ds_recommended.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_os_ds_recommended.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraOsDSRecommended.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_ha_availability_set_recommended.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_ha_availability_set_recommended.py new file mode 100644 index 0000000000000..be1f9be8b1cb4 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_ha_availability_set_recommended.py @@ -0,0 +1,124 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_os_ha_availability_set_recommended.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "highAvailabilityConfig": {"highAvailabilityType": "AvailabilitySet"}, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraOsHaAvailabilitySetRecommended.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_ha_availability_zone_recommended.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_ha_availability_zone_recommended.py new file mode 100644 index 0000000000000..acdb293a2e6ff --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_ha_availability_zone_recommended.py @@ -0,0 +1,124 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_os_ha_availability_zone_recommended.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 2, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "highAvailabilityConfig": {"highAvailabilityType": "AvailabilityZone"}, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraOsHaAvailabilityZoneRecommended.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_single_server_recommended.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_single_server_recommended.py new file mode 100644 index 0000000000000..d268efbc7d8b2 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_os_single_server_recommended.py @@ -0,0 +1,79 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_os_single_server_recommended.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "databaseType": "HANA", + "deploymentType": "SingleServer", + "networkConfiguration": {"isSecondaryIpEnabled": True}, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "NonProd", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraOsSIngleServerRecommended.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_single_server.py new file mode 100644 index 0000000000000..95e6c1f738695 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_single_server.py @@ -0,0 +1,78 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_single_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "Deployment", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "databaseType": "HANA", + "deploymentType": "SingleServer", + "networkConfiguration": {"isSecondaryIpEnabled": True}, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "ssh": {"publicKeys": [{"keyData": "ssh-rsa public key"}]}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + }, + "environment": "NonProd", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraSingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_with_existing_fileshare.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_with_existing_fileshare.py new file mode 100644 index 0000000000000..3cb03dedb6270 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_with_existing_fileshare.py @@ -0,0 +1,130 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_with_existing_fileshare.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "storageConfiguration": { + "transportFileShareConfiguration": { + "configurationType": "Mount", + "id": "/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint", + "privateEndpointId": "/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint", + } + }, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraWithExistingFileshare.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_with_new_fileshare.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_with_new_fileshare.py new file mode 100644 index 0000000000000..04f425410fafb --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_with_new_fileshare.py @@ -0,0 +1,130 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_with_new_fileshare.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "storageConfiguration": { + "transportFileShareConfiguration": { + "configurationType": "CreateAndMount", + "resourceGroup": "rgName", + "storageAccountName": "storageName", + } + }, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraWithNewFileshare.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_with_os_trusted_access.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_with_os_trusted_access.py new file mode 100644 index 0000000000000..d39bed0b80d09 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_with_os_trusted_access.py @@ -0,0 +1,124 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_with_os_trusted_access.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "managedResourcesNetworkAccessType": "Private", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraWithOsTrustedAccess.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_without_fileshare.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_without_fileshare.py new file mode 100644 index 0000000000000..bdb980b852c8d --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_infra_without_fileshare.py @@ -0,0 +1,124 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_infra_without_fileshare.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "westcentralus", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "X00-RG", + "applicationServer": { + "instanceCount": 6, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "centralServer": { + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_E16ds_v4", + }, + }, + "databaseServer": { + "databaseType": "HANA", + "instanceCount": 1, + "subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP", + "publisher": "RedHat", + "sku": "84sapha-gen2", + "version": "latest", + }, + "osProfile": { + "adminUsername": "{your-username}", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "xyz", "publicKey": "abc"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "storageConfiguration": {"transportFileShareConfiguration": {"configurationType": "Skip"}}, + }, + "osSapConfiguration": {"sapFqdn": "xyz.test.com"}, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInfraWithoutFileshare.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_install_ds.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_install_ds.py new file mode 100644 index 0000000000000..208b6680b9868 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_install_ds.py @@ -0,0 +1,129 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_install_ds.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "eastus2", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "{{resourcegrp}}", + "applicationServer": { + "instanceCount": 2, + "subnetId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "8.2", + "version": "8.2.2021091201", + }, + "osProfile": { + "adminUsername": "azureuser", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "{{privateKey}}", "publicKey": "{{sshkey}}"}, + }, + }, + "vmSize": "Standard_E4ds_v4", + }, + }, + "centralServer": { + "instanceCount": 1, + "subnetId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "8.2", + "version": "8.2.2021091201", + }, + "osProfile": { + "adminUsername": "azureuser", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "{{privateKey}}", "publicKey": "{{sshkey}}"}, + }, + }, + "vmSize": "Standard_E4ds_v4", + }, + }, + "databaseServer": { + "instanceCount": 1, + "subnetId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "RHEL-SAP-HA", + "publisher": "RedHat", + "sku": "8.2", + "version": "8.2.2021091201", + }, + "osProfile": { + "adminUsername": "azureuser", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "{{privateKey}}", "publicKey": "{{sshkey}}"}, + }, + }, + "vmSize": "Standard_M32ts", + }, + }, + "deploymentType": "ThreeTier", + "networkConfiguration": {"isSecondaryIpEnabled": True}, + }, + "osSapConfiguration": {"sapFqdn": "sap.bpaas.com"}, + "softwareConfiguration": { + "bomUrl": "https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml", + "sapBitsStorageAccountId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount", + "softwareInstallationType": "SAPInstallWithoutOSConfig", + "softwareVersion": "SAP S/4HANA 1909 SPS 03", + }, + }, + "environment": "Prod", + "sapProduct": "S4HANA", + }, + "tags": {"created by": "azureuser"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInstallDS.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_install_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_install_single_server.py new file mode 100644 index 0000000000000..12c80a93633e9 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_install_single_server.py @@ -0,0 +1,83 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_create_install_single_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_create( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + resource={ + "location": "eastus2", + "properties": { + "configuration": { + "appLocation": "eastus", + "configurationType": "DeploymentWithOSConfig", + "infrastructureConfiguration": { + "appResourceGroup": "test-rg", + "deploymentType": "SingleServer", + "subnetId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/testsubnet", + "virtualMachineConfiguration": { + "imageReference": { + "offer": "SLES-SAP", + "publisher": "SUSE", + "sku": "12-sp4-gen2", + "version": "2022.02.01", + }, + "osProfile": { + "adminUsername": "azureappadmin", + "osConfiguration": { + "disablePasswordAuthentication": True, + "osType": "Linux", + "sshKeyPair": {"privateKey": "{{privateKey}}", "publicKey": "{{sshkey}}"}, + }, + }, + "vmSize": "Standard_E32ds_v4", + }, + }, + "osSapConfiguration": {"sapFqdn": "sap.bpaas.com"}, + "softwareConfiguration": { + "bomUrl": "https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml", + "sapBitsStorageAccountId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount", + "softwareInstallationType": "SAPInstallWithoutOSConfig", + "softwareVersion": "SAP S/4HANA 1909 SPS 03", + }, + }, + "environment": "NonProd", + "sapProduct": "S4HANA", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateInstallSingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_register_sap_solutions.py similarity index 63% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_set.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_register_sap_solutions.py index dd0b45a86a4cb..ebf2805514d4c 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_set.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_register_sap_solutions.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_virtual_instances_create_disk_details_ha_av_set.py + python sap_virtual_instances_create_register_sap_solutions.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,28 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.begin_create( resource_group_name="test-rg", sap_virtual_instance_name="X00", + resource={ + "location": "northeurope", + "properties": { + "configuration": { + "centralServerVmId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0", + "configurationType": "Discovery", + }, + "environment": "NonProd", + "sapProduct": "S4HANA", + }, + "tags": {"createdby": "abc@microsoft.com", "test": "abc"}, + }, ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvSet.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateRegisterSapSolutions.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_distributed.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_register_sap_solutions_custom.py similarity index 60% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_distributed.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_register_sap_solutions_custom.py index 17b4d99341a56..a18e251fe8853 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_distributed.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_register_sap_solutions_custom.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_virtual_instances_create_custom_full_resource_names_distributed.py + python sap_virtual_instances_create_register_sap_solutions_custom.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,29 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.begin_create( resource_group_name="test-rg", sap_virtual_instance_name="X00", + resource={ + "location": "northeurope", + "properties": { + "configuration": { + "centralServerVmId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0", + "configurationType": "Discovery", + "managedRgStorageAccountName": "q20saacssgrs", + }, + "environment": "NonProd", + "sapProduct": "S4HANA", + }, + "tags": {"createdby": "abc@microsoft.com", "test": "abc"}, + }, ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_Distributed.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateRegisterSapSolutionsCustom.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_register_with_trusted_access.py similarity index 60% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_single_server.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_register_with_trusted_access.py index a687f1c655f59..4a8c174254db1 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_single_server.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_create_register_with_trusted_access.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_virtual_instances_create_custom_full_resource_names_single_server.py + python sap_virtual_instances_create_register_with_trusted_access.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,29 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.begin_create( resource_group_name="test-rg", sap_virtual_instance_name="X00", + resource={ + "location": "northeurope", + "properties": { + "configuration": { + "centralServerVmId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0", + "configurationType": "Discovery", + }, + "environment": "NonProd", + "managedResourcesNetworkAccessType": "Private", + "sapProduct": "S4HANA", + }, + "tags": {"createdby": "abc@microsoft.com", "test": "abc"}, + }, ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_SingleServer.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_CreateRegisterWithTrustedAccess.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_delete.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_delete.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_delete.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_delete.py index 11cc2ee1a6c50..de4bbb009162c 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_delete.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_delete.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) client.sap_virtual_instances.begin_delete( @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Delete.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_Delete.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_get.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_get.py index 78ea5db8ef50b..84dac03cf0fa6 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_get.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.get( @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Get.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_Get.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get_acssinstallation_blocked.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_get_acss_installation_blocked.py similarity index 77% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get_acssinstallation_blocked.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_get_acss_installation_blocked.py index da13c8426995a..3f778afc41a7c 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_get_acssinstallation_blocked.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_get_acss_installation_blocked.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_virtual_instances_get_acssinstallation_blocked.py + python sap_virtual_instances_get_acss_installation_blocked.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.get( @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Get_ACSSInstallationBlocked.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_GetAcssInstallationBlocked.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_availability_zone_details_eastus.py similarity index 72% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_single_server.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_availability_zone_details_eastus.py index f92bea2b14a02..4f6c6ee2658de 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_single_server.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_availability_zone_details_eastus.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_supported_skus_single_server.py + python sap_virtual_instances_invoke_availability_zone_details_eastus.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,15 +27,16 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_supported_sku( - location="centralus", + response = client.sap_virtual_instances.get_availability_zone_details( + location="eastus", + body={"appLocation": "eastus", "databaseType": "HANA", "sapProduct": "S4HANA"}, ) print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_SingleServer.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_InvokeAvailabilityZoneDetails_eastus.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_non_prod.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_availability_zone_details_northeurope.py similarity index 71% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_non_prod.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_availability_zone_details_northeurope.py index 95020fc1d68ac..b5aafbb4b8758 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_non_prod.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_availability_zone_details_northeurope.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_disk_configurations_non_prod.py + python sap_virtual_instances_invoke_availability_zone_details_northeurope.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,15 +27,16 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_disk_configurations( - location="centralus", + response = client.sap_virtual_instances.get_availability_zone_details( + location="northeurope", + body={"appLocation": "northeurope", "databaseType": "HANA", "sapProduct": "S4HANA"}, ) print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPDiskConfigurations_NonProd.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_InvokeAvailabilityZoneDetails_northeurope.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_disk_configurations_non_prod.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_disk_configurations_non_prod.py new file mode 100644 index 0000000000000..b4d549bc410b8 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_disk_configurations_non_prod.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_invoke_disk_configurations_non_prod.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.get_disk_configurations( + location="centralus", + body={ + "appLocation": "eastus", + "databaseType": "HANA", + "dbVmSku": "Standard_M32ts", + "deploymentType": "ThreeTier", + "environment": "NonProd", + "sapProduct": "S4HANA", + }, + ) + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_InvokeDiskConfigurations_NonProd.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_northeurope.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_disk_configurations_prod.py similarity index 68% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_northeurope.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_disk_configurations_prod.py index c17e0a71eced3..7fa1556f07ccd 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_northeurope.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_disk_configurations_prod.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_availability_zone_details_northeurope.py + python sap_virtual_instances_invoke_disk_configurations_prod.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,15 +27,23 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_availability_zone_details( + response = client.sap_virtual_instances.get_disk_configurations( location="centralus", + body={ + "appLocation": "eastus", + "databaseType": "HANA", + "dbVmSku": "Standard_M32ts", + "deploymentType": "ThreeTier", + "environment": "Prod", + "sapProduct": "S4HANA", + }, ) print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_northeurope.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_InvokeDiskConfigurations_Prod.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_prod.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sap_supported_sku_distributed.py similarity index 69% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_prod.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sap_supported_sku_distributed.py index a7bbf73b0dab0..7174302e68350 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_disk_configurations_prod.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sap_supported_sku_distributed.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_disk_configurations_prod.py + python sap_virtual_instances_invoke_sap_supported_sku_distributed.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,15 +27,22 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_disk_configurations( + response = client.sap_virtual_instances.get_sap_supported_sku( location="centralus", + body={ + "appLocation": "eastus", + "databaseType": "HANA", + "deploymentType": "ThreeTier", + "environment": "Prod", + "sapProduct": "S4HANA", + }, ) print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPDiskConfigurations_Prod.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_InvokeSapSupportedSku_Distributed.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sap_supported_sku_distributed_ha_av_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sap_supported_sku_distributed_ha_av_set.py new file mode 100644 index 0000000000000..662b3432a65dc --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sap_supported_sku_distributed_ha_av_set.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_invoke_sap_supported_sku_distributed_ha_av_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.get_sap_supported_sku( + location="centralus", + body={ + "appLocation": "eastus", + "databaseType": "HANA", + "deploymentType": "ThreeTier", + "environment": "Prod", + "highAvailabilityType": "AvailabilitySet", + "sapProduct": "S4HANA", + }, + ) + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_InvokeSapSupportedSku_DistributedHA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sap_supported_sku_distributed_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sap_supported_sku_distributed_ha_av_zone.py new file mode 100644 index 0000000000000..57311bd4e784e --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sap_supported_sku_distributed_ha_av_zone.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_invoke_sap_supported_sku_distributed_ha_av_zone.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.get_sap_supported_sku( + location="centralus", + body={ + "appLocation": "eastus", + "databaseType": "HANA", + "deploymentType": "ThreeTier", + "environment": "Prod", + "highAvailabilityType": "AvailabilityZone", + "sapProduct": "S4HANA", + }, + ) + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_InvokeSapSupportedSku_DistributedHA_AvZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_eastus.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sap_supported_sku_single_server.py similarity index 69% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_eastus.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sap_supported_sku_single_server.py index 86ce93bbcf88f..fd2d1217aca8a 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_availability_zone_details_eastus.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sap_supported_sku_single_server.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_availability_zone_details_eastus.py + python sap_virtual_instances_invoke_sap_supported_sku_single_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,15 +27,22 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) - response = client.sap_availability_zone_details( + response = client.sap_virtual_instances.get_sap_supported_sku( location="centralus", + body={ + "appLocation": "eastus", + "databaseType": "HANA", + "deploymentType": "SingleServer", + "environment": "NonProd", + "sapProduct": "S4HANA", + }, ) print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPAvailabilityZoneDetails_eastus.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_InvokeSapSupportedSku_SingleServer.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sizing_recommendations_s4_hana_distributed.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sizing_recommendations_s4_hana_distributed.py new file mode 100644 index 0000000000000..3d494d59d44dc --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sizing_recommendations_s4_hana_distributed.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_invoke_sizing_recommendations_s4_hana_distributed.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.get_sizing_recommendations( + location="centralus", + body={ + "appLocation": "eastus", + "databaseType": "HANA", + "dbMemory": 1024, + "dbScaleMethod": "ScaleUp", + "deploymentType": "ThreeTier", + "environment": "Prod", + "sapProduct": "S4HANA", + "saps": 20000, + }, + ) + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_InvokeSizingRecommendations_S4HANA_Distributed.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sizing_recommendations_s4_hana_ha_av_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sizing_recommendations_s4_hana_ha_av_set.py new file mode 100644 index 0000000000000..487ab59a6d892 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sizing_recommendations_s4_hana_ha_av_set.py @@ -0,0 +1,52 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_invoke_sizing_recommendations_s4_hana_ha_av_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.get_sizing_recommendations( + location="centralus", + body={ + "appLocation": "eastus", + "databaseType": "HANA", + "dbMemory": 1024, + "dbScaleMethod": "ScaleUp", + "deploymentType": "ThreeTier", + "environment": "Prod", + "highAvailabilityType": "AvailabilitySet", + "sapProduct": "S4HANA", + "saps": 75000, + }, + ) + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_InvokeSizingRecommendations_S4HANA_HA_AvSet.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sizing_recommendations_s4_hana_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sizing_recommendations_s4_hana_ha_av_zone.py new file mode 100644 index 0000000000000..5eae9be4146d1 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sizing_recommendations_s4_hana_ha_av_zone.py @@ -0,0 +1,52 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_invoke_sizing_recommendations_s4_hana_ha_av_zone.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.get_sizing_recommendations( + location="centralus", + body={ + "appLocation": "eastus", + "databaseType": "HANA", + "dbMemory": 1024, + "dbScaleMethod": "ScaleUp", + "deploymentType": "ThreeTier", + "environment": "Prod", + "highAvailabilityType": "AvailabilityZone", + "sapProduct": "S4HANA", + "saps": 75000, + }, + ) + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_InvokeSizingRecommendations_S4HANA_HA_AvZone.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sizing_recommendations_s4_hana_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sizing_recommendations_s4_hana_single_server.py new file mode 100644 index 0000000000000..804e349172c09 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_invoke_sizing_recommendations_s4_hana_single_server.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_invoke_sizing_recommendations_s4_hana_single_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.get_sizing_recommendations( + location="centralus", + body={ + "appLocation": "eastus", + "databaseType": "HANA", + "dbMemory": 2000, + "dbScaleMethod": "ScaleUp", + "deploymentType": "SingleServer", + "environment": "NonProd", + "sapProduct": "S4HANA", + "saps": 60000, + }, + ) + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_InvokeSizingRecommendations_S4HANA_SingleServer.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_resource_group.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_list_by_resource_group.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_resource_group.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_list_by_resource_group.py index 3957cf9e9126e..07c31fe910c09 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_resource_group.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_list_by_resource_group.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.list_by_resource_group( @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_ListByResourceGroup.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_subscription.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_list_by_subscription.py similarity index 80% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_subscription.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_list_by_subscription.py index 136f3316a5f45..9ea69b86881e2 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_subscription.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_list_by_subscription.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.list_by_subscription() @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_ListBySubscription.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_soft_stop.py similarity index 77% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop_with_infra_operations.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_soft_stop.py index 77b4f99952e33..04c8ebfde22cd 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop_with_infra_operations.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_soft_stop.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_virtual_instances_stop_with_infra_operations.py + python sap_virtual_instances_soft_stop.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.begin_stop( @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Stop_WithInfraOperations.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_SoftStop.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_soft_stop_vm_and_system.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_soft_stop_vm_and_system.py new file mode 100644 index 0000000000000..eba6d588b4a77 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_soft_stop_vm_and_system.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_soft_stop_vm_and_system.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_stop( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_SoftStopVMAndSystem.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_start.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_start.py index 55bdf5d694e5b..7b94d62bccfdf 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_start.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.begin_start( @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Start.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_Start.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_start_with_infra_operations.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start_with_infra_operations.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_start_with_infra_operations.py index 145c686294f86..c02c9660fe244 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_start_with_infra_operations.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_start_with_infra_operations.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.begin_start( @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Start_WithInfraOperations.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_StartWithInfraOperations.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_stop.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_stop.py index c31500bd84cb2..1addd62d37b11 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_stop.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_stop.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,7 +27,7 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.begin_stop( @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Stop.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_Stop.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_stop_vm_and_system.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_stop_vm_and_system.py new file mode 100644 index 0000000000000..02d77c72f73e1 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_stop_vm_and_system.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-workloadssapvirtualinstance +# USAGE + python sap_virtual_instances_stop_vm_and_system.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = WorkloadsSapVirtualInstanceMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.sap_virtual_instances.begin_stop( + resource_group_name="test-rg", + sap_virtual_instance_name="X00", + ).result() + print(response) + + +# x-ms-original-file: 2024-09-01/SapVirtualInstances_StopVMAndSystem.json +if __name__ == "__main__": + main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_update.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_update.py similarity index 81% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_update.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_update.py index 1aec950e7f0a9..00d3d65120b32 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_update.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_update.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -26,16 +27,17 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.begin_update( resource_group_name="test-rg", sap_virtual_instance_name="X00", + properties={"identity": {"type": "None"}, "properties": {}, "tags": {"key1": "svi1"}}, ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Update.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_Update.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_trusted_access_enable_update.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_update_trusted_access.py similarity index 76% rename from sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_trusted_access_enable_update.py rename to sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_update_trusted_access.py index 7413a2f63cdcc..430e7fb96f23c 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_trusted_access_enable_update.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sap_virtual_instances_update_trusted_access.py @@ -2,11 +2,12 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient """ @@ -14,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-workloadssapvirtualinstance # USAGE - python sap_virtual_instances_trusted_access_enable_update.py + python sap_virtual_instances_update_trusted_access.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -26,16 +27,21 @@ def main(): client = WorkloadsSapVirtualInstanceMgmtClient( credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", + subscription_id="SUBSCRIPTION_ID", ) response = client.sap_virtual_instances.begin_update( resource_group_name="test-rg", sap_virtual_instance_name="X00", + properties={ + "identity": {"type": "None"}, + "properties": {"managedResourcesNetworkAccessType": "Private"}, + "tags": {"key1": "svi1"}, + }, ).result() print(response) -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_TrustedAccessEnable_Update.json +# x-ms-original-file: 2024-09-01/SapVirtualInstances_UpdateTrustedAccess.json if __name__ == "__main__": main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance_with_infra_operations.py deleted file mode 100644 index 63fd507dfde28..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_start_instance_with_infra_operations.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_central_instances_start_instance_with_infra_operations.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_central_instances.begin_start_instance( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - central_instance_name="centralServer", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StartInstance_WithInfraOperations.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance_with_infra_operations.py deleted file mode 100644 index 7c9311d087c85..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapcentralinstances/sap_central_instances_stop_instance_with_infra_operations.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_central_instances_stop_instance_with_infra_operations.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_central_instances.begin_stop_instance( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - central_instance_name="centralServer", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapcentralinstances/SAPCentralInstances_StopInstance_WithInfraOperations.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance_with_infra_operations.py deleted file mode 100644 index 68d73636ecc2d..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_start_instance_with_infra_operations.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_database_instances_start_instance_with_infra_operations.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_database_instances.begin_start_instance( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - database_instance_name="db0", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StartInstance_WithInfraOperations.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance_with_infra_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance_with_infra_operations.py deleted file mode 100644 index b44856199dbae..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapdatabaseinstances/sap_database_instances_stop_instance_with_infra_operations.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_database_instances_stop_instance_with_infra_operations.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_database_instances.begin_stop_instance( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - database_instance_name="db0", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapdatabaseinstances/SAPDatabaseInstances_StopInstance_WithInfraOperations.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_distributed.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_distributed.py deleted file mode 100644 index 568a4ffd4d3de..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_distributed.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_sizing_recommendations_s4_hana_distributed.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_sizing_recommendations( - location="centralus", - ) - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_Distributed.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_set.py deleted file mode 100644 index 007181a4328c8..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_set.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_sizing_recommendations_s4_hana_ha_av_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_sizing_recommendations( - location="centralus", - ) - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvSet.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_zone.py deleted file mode 100644 index 1f999bbc137ad..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_zone.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_sizing_recommendations_s4_hana_ha_av_zone.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_sizing_recommendations( - location="centralus", - ) - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_HA_AvZone.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_single_server.py deleted file mode 100644 index f0f0471731959..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_single_server.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_sizing_recommendations_s4_hana_single_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_sizing_recommendations( - location="centralus", - ) - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSizingRecommendations_S4HANA_SingleServer.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed.py deleted file mode 100644 index 40d911e548468..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_supported_skus_distributed.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_supported_sku( - location="centralus", - ) - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_Distributed.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_set.py deleted file mode 100644 index b8094212e25c6..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_set.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_supported_skus_distributed_ha_av_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_supported_sku( - location="centralus", - ) - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvSet.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_zone.py deleted file mode 100644 index 17425c1d67116..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_zone.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_supported_skus_distributed_ha_av_zone.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_supported_sku( - location="centralus", - ) - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPSupportedSkus_DistributedHA_AvZone.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py deleted file mode 100644 index 9e2e6e0607c8f..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvSet.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py deleted file mode 100644 index f39a0d63ea7bd..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvZone.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_image.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_image.py deleted file mode 100644 index baae2a929c12d..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_image.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_custom_image.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Custom_Image.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py deleted file mode 100644 index 86c0cba669610..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_CustomMrgStorageAccountName.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_trusted_access_enable.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_trusted_access_enable.py deleted file mode 100644 index d84ab2081ad49..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_trusted_access_enable.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_discover_trusted_access_enable.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_TrustedAccessEnable.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_distributed.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_distributed.py deleted file mode 100644 index 993199e3ac4b6..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_distributed.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_disk_details_distributed.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_Distributed.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_zone.py deleted file mode 100644 index 777a9191e92d5..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_zone.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_disk_details_ha_av_zone.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvZone.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_single_server.py deleted file mode 100644 index da7b427cddcba..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_single_server.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_disk_details_single_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_SingleServer.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_create_transport.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_create_transport.py deleted file mode 100644 index 5ebfbc1412a1f..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_create_transport.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_distributed_create_transport.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_CreateTransport.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_mount_transport.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_mount_transport.py deleted file mode 100644 index 33ad3ee448b89..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_mount_transport.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_distributed_mount_transport.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_MountTransport.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_skip_transport.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_skip_transport.py deleted file mode 100644 index 319905cb11537..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_skip_transport.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_distributed_skip_transport.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_SkipTransport.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_single_server.py deleted file mode 100644 index 3117151647371..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_single_server.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_single_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_SingleServer.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_distributed.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_distributed.py deleted file mode 100644 index 25fb9081e4b89..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_distributed.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_with_os_config_distributed.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_Distributed.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_set.py deleted file mode 100644 index 66e46b49da4c9..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_set.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_with_os_config_ha_av_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvSet.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_zone.py deleted file mode 100644 index c6cdc078b0b6d..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_zone.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_with_os_config_ha_av_zone.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvZone.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_single_server.py deleted file mode 100644 index b26de8a0359d1..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_single_server.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_with_os_config_single_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_SingleServer.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_with_trusted_access.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_with_trusted_access.py deleted file mode 100644 index 8618c0f4ce35a..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_with_trusted_access.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_create_with_os_config_with_trusted_access.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_WithTrustedAccess.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_distributed.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_distributed.py deleted file mode 100644 index a8adef0e30daa..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_distributed.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_detect_installation_distributed.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_Distributed.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_set.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_set.py deleted file mode 100644 index bc153e2180208..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_set.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_detect_installation_ha_av_set.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvSet.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_zone.py deleted file mode 100644 index 5c18cbe18207b..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_zone.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_detect_installation_ha_av_zone.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvZone.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_single_server.py deleted file mode 100644 index 0f754da9addd5..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_single_server.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_detect_installation_single_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_SingleServer.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_distributed.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_distributed.py deleted file mode 100644 index d72474892e419..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_distributed.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_install_distributed.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Install_Distributed.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_single_server.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_single_server.py deleted file mode 100644 index cb566eef0fade..0000000000000 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_samples/sapvirtualinstances/sap_virtual_instances_install_single_server.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-workloadssapvirtualinstance -# USAGE - python sap_virtual_instances_install_single_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = WorkloadsSapVirtualInstanceMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0", - ) - - response = client.sap_virtual_instances.begin_create( - resource_group_name="test-rg", - sap_virtual_instance_name="X00", - ).result() - print(response) - - -# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPVirtualInstance/preview/2023-10-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Install_SingleServer.json -if __name__ == "__main__": - main() diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/conftest.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/conftest.py new file mode 100644 index 0000000000000..26ce9aba0d512 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/conftest.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + workloadssapvirtualinstancemgmt_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + workloadssapvirtualinstancemgmt_tenant_id = os.environ.get( + "AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000" + ) + workloadssapvirtualinstancemgmt_client_id = os.environ.get( + "AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000" + ) + workloadssapvirtualinstancemgmt_client_secret = os.environ.get( + "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=workloadssapvirtualinstancemgmt_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=workloadssapvirtualinstancemgmt_tenant_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=workloadssapvirtualinstancemgmt_client_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=workloadssapvirtualinstancemgmt_client_secret, value="00000000-0000-0000-0000-000000000000" + ) + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_operations.py new file mode 100644 index 0000000000000..8faf26e39d9af --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_operations.py @@ -0,0 +1,27 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWorkloadsSapVirtualInstanceMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WorkloadsSapVirtualInstanceMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_operations_async.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_operations_async.py new file mode 100644 index 0000000000000..f482f57318b32 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_operations_async.py @@ -0,0 +1,28 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.workloadssapvirtualinstance.aio import WorkloadsSapVirtualInstanceMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWorkloadsSapVirtualInstanceMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WorkloadsSapVirtualInstanceMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_application_server_instances_operations.py new file mode 100644 index 0000000000000..3eec4336a67ae --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_application_server_instances_operations.py @@ -0,0 +1,136 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWorkloadsSapVirtualInstanceMgmtSAPApplicationServerInstancesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WorkloadsSapVirtualInstanceMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_application_server_instances_get(self, resource_group): + response = self.client.sap_application_server_instances.get( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + application_instance_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_application_server_instances_begin_create(self, resource_group): + response = self.client.sap_application_server_instances.begin_create( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + application_instance_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "dispatcherStatus": "str", + "errors": {"properties": {"code": "str", "details": [...], "message": "str"}}, + "gatewayPort": 0, + "health": "str", + "hostname": "str", + "icmHttpPort": 0, + "icmHttpsPort": 0, + "instanceNo": "str", + "ipAddress": "str", + "kernelPatch": "str", + "kernelVersion": "str", + "loadBalancerDetails": {"id": "str"}, + "provisioningState": "str", + "status": "str", + "subnet": "str", + "vmDetails": [{"storageDetails": [{"id": "str"}], "type": "str", "virtualMachineId": "str"}], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_application_server_instances_update(self, resource_group): + response = self.client.sap_application_server_instances.update( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + application_instance_name="str", + properties={"tags": {"str": "str"}}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_application_server_instances_begin_delete(self, resource_group): + response = self.client.sap_application_server_instances.begin_delete( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + application_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_application_server_instances_list(self, resource_group): + response = self.client.sap_application_server_instances.list( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_application_server_instances_begin_start(self, resource_group): + response = self.client.sap_application_server_instances.begin_start( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + application_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_application_server_instances_begin_stop(self, resource_group): + response = self.client.sap_application_server_instances.begin_stop( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + application_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_application_server_instances_operations_async.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_application_server_instances_operations_async.py new file mode 100644 index 0000000000000..025093baa5c2d --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_application_server_instances_operations_async.py @@ -0,0 +1,145 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.workloadssapvirtualinstance.aio import WorkloadsSapVirtualInstanceMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWorkloadsSapVirtualInstanceMgmtSAPApplicationServerInstancesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WorkloadsSapVirtualInstanceMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_application_server_instances_get(self, resource_group): + response = await self.client.sap_application_server_instances.get( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + application_instance_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_application_server_instances_begin_create(self, resource_group): + response = await ( + await self.client.sap_application_server_instances.begin_create( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + application_instance_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "dispatcherStatus": "str", + "errors": {"properties": {"code": "str", "details": [...], "message": "str"}}, + "gatewayPort": 0, + "health": "str", + "hostname": "str", + "icmHttpPort": 0, + "icmHttpsPort": 0, + "instanceNo": "str", + "ipAddress": "str", + "kernelPatch": "str", + "kernelVersion": "str", + "loadBalancerDetails": {"id": "str"}, + "provisioningState": "str", + "status": "str", + "subnet": "str", + "vmDetails": [{"storageDetails": [{"id": "str"}], "type": "str", "virtualMachineId": "str"}], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_application_server_instances_update(self, resource_group): + response = await self.client.sap_application_server_instances.update( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + application_instance_name="str", + properties={"tags": {"str": "str"}}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_application_server_instances_begin_delete(self, resource_group): + response = await ( + await self.client.sap_application_server_instances.begin_delete( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + application_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_application_server_instances_list(self, resource_group): + response = self.client.sap_application_server_instances.list( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_application_server_instances_begin_start(self, resource_group): + response = await ( + await self.client.sap_application_server_instances.begin_start( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + application_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_application_server_instances_begin_stop(self, resource_group): + response = await ( + await self.client.sap_application_server_instances.begin_stop( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + application_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_central_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_central_server_instances_operations.py new file mode 100644 index 0000000000000..3c53b495c42b9 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_central_server_instances_operations.py @@ -0,0 +1,150 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWorkloadsSapVirtualInstanceMgmtSAPCentralServerInstancesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WorkloadsSapVirtualInstanceMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_central_server_instances_get(self, resource_group): + response = self.client.sap_central_server_instances.get( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + central_instance_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_central_server_instances_begin_create(self, resource_group): + response = self.client.sap_central_server_instances.begin_create( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + central_instance_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "enqueueReplicationServerProperties": { + "ersVersion": "str", + "health": "str", + "hostname": "str", + "instanceNo": "str", + "ipAddress": "str", + "kernelPatch": "str", + "kernelVersion": "str", + }, + "enqueueServerProperties": {"health": "str", "hostname": "str", "ipAddress": "str", "port": 0}, + "errors": {"properties": {"code": "str", "details": [...], "message": "str"}}, + "gatewayServerProperties": {"health": "str", "port": 0}, + "health": "str", + "instanceNo": "str", + "kernelPatch": "str", + "kernelVersion": "str", + "loadBalancerDetails": {"id": "str"}, + "messageServerProperties": { + "health": "str", + "hostname": "str", + "httpPort": 0, + "httpsPort": 0, + "internalMsPort": 0, + "ipAddress": "str", + "msPort": 0, + }, + "provisioningState": "str", + "status": "str", + "subnet": "str", + "vmDetails": [{"storageDetails": [{"id": "str"}], "type": "str", "virtualMachineId": "str"}], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_central_server_instances_update(self, resource_group): + response = self.client.sap_central_server_instances.update( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + central_instance_name="str", + properties={"tags": {"str": "str"}}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_central_server_instances_begin_delete(self, resource_group): + response = self.client.sap_central_server_instances.begin_delete( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + central_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_central_server_instances_list(self, resource_group): + response = self.client.sap_central_server_instances.list( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_central_server_instances_begin_start(self, resource_group): + response = self.client.sap_central_server_instances.begin_start( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + central_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_central_server_instances_begin_stop(self, resource_group): + response = self.client.sap_central_server_instances.begin_stop( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + central_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_central_server_instances_operations_async.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_central_server_instances_operations_async.py new file mode 100644 index 0000000000000..008eef1aafe41 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_central_server_instances_operations_async.py @@ -0,0 +1,159 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.workloadssapvirtualinstance.aio import WorkloadsSapVirtualInstanceMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWorkloadsSapVirtualInstanceMgmtSAPCentralServerInstancesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WorkloadsSapVirtualInstanceMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_central_server_instances_get(self, resource_group): + response = await self.client.sap_central_server_instances.get( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + central_instance_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_central_server_instances_begin_create(self, resource_group): + response = await ( + await self.client.sap_central_server_instances.begin_create( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + central_instance_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "enqueueReplicationServerProperties": { + "ersVersion": "str", + "health": "str", + "hostname": "str", + "instanceNo": "str", + "ipAddress": "str", + "kernelPatch": "str", + "kernelVersion": "str", + }, + "enqueueServerProperties": {"health": "str", "hostname": "str", "ipAddress": "str", "port": 0}, + "errors": {"properties": {"code": "str", "details": [...], "message": "str"}}, + "gatewayServerProperties": {"health": "str", "port": 0}, + "health": "str", + "instanceNo": "str", + "kernelPatch": "str", + "kernelVersion": "str", + "loadBalancerDetails": {"id": "str"}, + "messageServerProperties": { + "health": "str", + "hostname": "str", + "httpPort": 0, + "httpsPort": 0, + "internalMsPort": 0, + "ipAddress": "str", + "msPort": 0, + }, + "provisioningState": "str", + "status": "str", + "subnet": "str", + "vmDetails": [{"storageDetails": [{"id": "str"}], "type": "str", "virtualMachineId": "str"}], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_central_server_instances_update(self, resource_group): + response = await self.client.sap_central_server_instances.update( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + central_instance_name="str", + properties={"tags": {"str": "str"}}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_central_server_instances_begin_delete(self, resource_group): + response = await ( + await self.client.sap_central_server_instances.begin_delete( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + central_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_central_server_instances_list(self, resource_group): + response = self.client.sap_central_server_instances.list( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_central_server_instances_begin_start(self, resource_group): + response = await ( + await self.client.sap_central_server_instances.begin_start( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + central_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_central_server_instances_begin_stop(self, resource_group): + response = await ( + await self.client.sap_central_server_instances.begin_stop( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + central_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_database_instances_operations.py new file mode 100644 index 0000000000000..8e2a3a478ca41 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_database_instances_operations.py @@ -0,0 +1,129 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWorkloadsSapVirtualInstanceMgmtSAPDatabaseInstancesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WorkloadsSapVirtualInstanceMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_database_instances_get(self, resource_group): + response = self.client.sap_database_instances.get( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + database_instance_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_database_instances_begin_create(self, resource_group): + response = self.client.sap_database_instances.begin_create( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + database_instance_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "databaseSid": "str", + "databaseType": "str", + "errors": {"properties": {"code": "str", "details": [...], "message": "str"}}, + "ipAddress": "str", + "loadBalancerDetails": {"id": "str"}, + "provisioningState": "str", + "status": "str", + "subnet": "str", + "vmDetails": [{"status": "str", "storageDetails": [{"id": "str"}], "virtualMachineId": "str"}], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_database_instances_update(self, resource_group): + response = self.client.sap_database_instances.update( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + database_instance_name="str", + properties={"tags": {"str": "str"}}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_database_instances_begin_delete(self, resource_group): + response = self.client.sap_database_instances.begin_delete( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + database_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_database_instances_list(self, resource_group): + response = self.client.sap_database_instances.list( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_database_instances_begin_start(self, resource_group): + response = self.client.sap_database_instances.begin_start( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + database_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_database_instances_begin_stop(self, resource_group): + response = self.client.sap_database_instances.begin_stop( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + database_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_database_instances_operations_async.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_database_instances_operations_async.py new file mode 100644 index 0000000000000..ec7315e8cb0ca --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_database_instances_operations_async.py @@ -0,0 +1,138 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.workloadssapvirtualinstance.aio import WorkloadsSapVirtualInstanceMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWorkloadsSapVirtualInstanceMgmtSAPDatabaseInstancesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WorkloadsSapVirtualInstanceMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_database_instances_get(self, resource_group): + response = await self.client.sap_database_instances.get( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + database_instance_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_database_instances_begin_create(self, resource_group): + response = await ( + await self.client.sap_database_instances.begin_create( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + database_instance_name="str", + resource={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "databaseSid": "str", + "databaseType": "str", + "errors": {"properties": {"code": "str", "details": [...], "message": "str"}}, + "ipAddress": "str", + "loadBalancerDetails": {"id": "str"}, + "provisioningState": "str", + "status": "str", + "subnet": "str", + "vmDetails": [{"status": "str", "storageDetails": [{"id": "str"}], "virtualMachineId": "str"}], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_database_instances_update(self, resource_group): + response = await self.client.sap_database_instances.update( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + database_instance_name="str", + properties={"tags": {"str": "str"}}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_database_instances_begin_delete(self, resource_group): + response = await ( + await self.client.sap_database_instances.begin_delete( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + database_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_database_instances_list(self, resource_group): + response = self.client.sap_database_instances.list( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_database_instances_begin_start(self, resource_group): + response = await ( + await self.client.sap_database_instances.begin_start( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + database_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_database_instances_begin_stop(self, resource_group): + response = await ( + await self.client.sap_database_instances.begin_stop( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + database_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_virtual_instances_operations.py new file mode 100644 index 0000000000000..e86cc827363b1 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_virtual_instances_operations.py @@ -0,0 +1,210 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.workloadssapvirtualinstance import WorkloadsSapVirtualInstanceMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWorkloadsSapVirtualInstanceMgmtSAPVirtualInstancesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WorkloadsSapVirtualInstanceMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_virtual_instances_get(self, resource_group): + response = self.client.sap_virtual_instances.get( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_virtual_instances_begin_create(self, resource_group): + response = self.client.sap_virtual_instances.begin_create( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + resource={ + "location": "str", + "id": "str", + "identity": { + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "properties": { + "configuration": "sap_configuration", + "environment": "str", + "sapProduct": "str", + "errors": {"properties": {"code": "str", "details": [...], "message": "str"}}, + "health": "str", + "managedResourceGroupConfiguration": {"name": "str"}, + "managedResourcesNetworkAccessType": "str", + "provisioningState": "str", + "state": "str", + "status": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_virtual_instances_begin_update(self, resource_group): + response = self.client.sap_virtual_instances.begin_update( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + properties={ + "identity": { + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": {"managedResourcesNetworkAccessType": "str"}, + "tags": {"str": "str"}, + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_virtual_instances_begin_delete(self, resource_group): + response = self.client.sap_virtual_instances.begin_delete( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_virtual_instances_list_by_resource_group(self, resource_group): + response = self.client.sap_virtual_instances.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_virtual_instances_list_by_subscription(self, resource_group): + response = self.client.sap_virtual_instances.list_by_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_virtual_instances_begin_start(self, resource_group): + response = self.client.sap_virtual_instances.begin_start( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_virtual_instances_begin_stop(self, resource_group): + response = self.client.sap_virtual_instances.begin_stop( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_virtual_instances_get_sizing_recommendations(self, resource_group): + response = self.client.sap_virtual_instances.get_sizing_recommendations( + location="str", + body={ + "appLocation": "str", + "databaseType": "str", + "dbMemory": 0, + "deploymentType": "str", + "environment": "str", + "sapProduct": "str", + "saps": 0, + "dbScaleMethod": "str", + "highAvailabilityType": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_virtual_instances_get_sap_supported_sku(self, resource_group): + response = self.client.sap_virtual_instances.get_sap_supported_sku( + location="str", + body={ + "appLocation": "str", + "databaseType": "str", + "deploymentType": "str", + "environment": "str", + "sapProduct": "str", + "highAvailabilityType": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_virtual_instances_get_disk_configurations(self, resource_group): + response = self.client.sap_virtual_instances.get_disk_configurations( + location="str", + body={ + "appLocation": "str", + "databaseType": "str", + "dbVmSku": "str", + "deploymentType": "str", + "environment": "str", + "sapProduct": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sap_virtual_instances_get_availability_zone_details(self, resource_group): + response = self.client.sap_virtual_instances.get_availability_zone_details( + location="str", + body={"appLocation": "str", "databaseType": "str", "sapProduct": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_virtual_instances_operations_async.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_virtual_instances_operations_async.py new file mode 100644 index 0000000000000..99a1cbe15766d --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/generated_tests/test_workloads_sap_virtual_instance_mgmt_sap_virtual_instances_operations_async.py @@ -0,0 +1,221 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.workloadssapvirtualinstance.aio import WorkloadsSapVirtualInstanceMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestWorkloadsSapVirtualInstanceMgmtSAPVirtualInstancesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(WorkloadsSapVirtualInstanceMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_virtual_instances_get(self, resource_group): + response = await self.client.sap_virtual_instances.get( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_virtual_instances_begin_create(self, resource_group): + response = await ( + await self.client.sap_virtual_instances.begin_create( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + resource={ + "location": "str", + "id": "str", + "identity": { + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "properties": { + "configuration": "sap_configuration", + "environment": "str", + "sapProduct": "str", + "errors": {"properties": {"code": "str", "details": [...], "message": "str"}}, + "health": "str", + "managedResourceGroupConfiguration": {"name": "str"}, + "managedResourcesNetworkAccessType": "str", + "provisioningState": "str", + "state": "str", + "status": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_virtual_instances_begin_update(self, resource_group): + response = await ( + await self.client.sap_virtual_instances.begin_update( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + properties={ + "identity": { + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": {"managedResourcesNetworkAccessType": "str"}, + "tags": {"str": "str"}, + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_virtual_instances_begin_delete(self, resource_group): + response = await ( + await self.client.sap_virtual_instances.begin_delete( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_virtual_instances_list_by_resource_group(self, resource_group): + response = self.client.sap_virtual_instances.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_virtual_instances_list_by_subscription(self, resource_group): + response = self.client.sap_virtual_instances.list_by_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_virtual_instances_begin_start(self, resource_group): + response = await ( + await self.client.sap_virtual_instances.begin_start( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_virtual_instances_begin_stop(self, resource_group): + response = await ( + await self.client.sap_virtual_instances.begin_stop( + resource_group_name=resource_group.name, + sap_virtual_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_virtual_instances_get_sizing_recommendations(self, resource_group): + response = await self.client.sap_virtual_instances.get_sizing_recommendations( + location="str", + body={ + "appLocation": "str", + "databaseType": "str", + "dbMemory": 0, + "deploymentType": "str", + "environment": "str", + "sapProduct": "str", + "saps": 0, + "dbScaleMethod": "str", + "highAvailabilityType": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_virtual_instances_get_sap_supported_sku(self, resource_group): + response = await self.client.sap_virtual_instances.get_sap_supported_sku( + location="str", + body={ + "appLocation": "str", + "databaseType": "str", + "deploymentType": "str", + "environment": "str", + "sapProduct": "str", + "highAvailabilityType": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_virtual_instances_get_disk_configurations(self, resource_group): + response = await self.client.sap_virtual_instances.get_disk_configurations( + location="str", + body={ + "appLocation": "str", + "databaseType": "str", + "dbVmSku": "str", + "deploymentType": "str", + "environment": "str", + "sapProduct": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sap_virtual_instances_get_availability_zone_details(self, resource_group): + response = await self.client.sap_virtual_instances.get_availability_zone_details( + location="str", + body={"appLocation": "str", "databaseType": "str", "sapProduct": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/setup.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/setup.py index 36f074a486c7c..a1424c5e63c8b 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/setup.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/setup.py @@ -74,9 +74,10 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", + "isodate>=0.6.1", + "typing-extensions>=4.6.0", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], python_requires=">=3.8", ) diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/tests/conftest.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/tests/conftest.py index 5b69b784b4e23..e5154f6317193 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/tests/conftest.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/tests/conftest.py @@ -35,6 +35,7 @@ load_dotenv() + @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") @@ -56,4 +57,4 @@ def add_sanitizers(test_proxy): add_body_key_sanitizer(json_path="$..publicKey", value="publicKey") add_body_key_sanitizer(json_path="$..privateKey", value="privateKey") add_body_key_sanitizer(json_path="$........publicKey", value="publicKey") - add_body_key_sanitizer(json_path="$........privateKey", value="privateKey") \ No newline at end of file + add_body_key_sanitizer(json_path="$........privateKey", value="privateKey") diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/tests/test_cli_mgmt_workloadssapvirtualinstance.py b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/tests/test_cli_mgmt_workloadssapvirtualinstance.py index 97f2274d9655b..4b82883376484 100644 --- a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/tests/test_cli_mgmt_workloadssapvirtualinstance.py +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/tests/test_cli_mgmt_workloadssapvirtualinstance.py @@ -19,7 +19,7 @@ SAP_VIRTUAL_INSTANCE_NAME = "S08" -@pytest.mark.skipif(os.getenv('AZURE_TEST_RUN_LIVE') not in ('true', 'yes'), reason='only run live test') +@pytest.mark.skipif(os.getenv("AZURE_TEST_RUN_LIVE") not in ("true", "yes"), reason="only run live test") class TestMgmtWorkloadsSapVirtualInstance(AzureMgmtRecordedTestCase): def setup_method(self, method): self.mgmt_client = self.create_mgmt_client(WorkloadsSapVirtualInstanceMgmtClient) diff --git a/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/tsp-location.yaml b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/tsp-location.yaml new file mode 100644 index 0000000000000..cf55120f942b2 --- /dev/null +++ b/sdk/workloads/azure-mgmt-workloadssapvirtualinstance/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/workloads/Workloads.SAPVirtualInstance.Management +commit: 37cac643c368dd75de2b98d1d0e3b16dea37b2eb +repo: Azure/azure-rest-api-specs +additionalDirectories: