diff --git a/sdk/workloads/azure-mgmt-workloads/README.md b/sdk/workloads/azure-mgmt-workloads/README.md
index 82532ac12249..d26eb403f0bb 100644
--- a/sdk/workloads/azure-mgmt-workloads/README.md
+++ b/sdk/workloads/azure-mgmt-workloads/README.md
@@ -1,7 +1,7 @@
# Microsoft Azure SDK for Python
This is the Microsoft Azure Workloads Management Client Library.
-This package has been tested with Python 3.7+.
+This package has been tested with Python 3.8+.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
## _Disclaimer_
@@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
### Prerequisites
-- Python 3.7+ is required to use this package.
+- Python 3.8+ is required to use this package.
- [Azure subscription](https://azure.microsoft.com/free/)
### Install the package
@@ -45,8 +45,9 @@ client = WorkloadsClient(credential=DefaultAzureCredential(), subscription_id=su
## Examples
-
-Code samples for this package can be found at [Workloads Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
+Code samples for this package can be found at:
+- [Search Workloads Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com
+- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
## Troubleshooting
@@ -58,6 +59,3 @@ Code samples for this package can be found at [Workloads Management](https://doc
If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.
-
-
-
diff --git a/sdk/workloads/azure-mgmt-workloads/_meta.json b/sdk/workloads/azure-mgmt-workloads/_meta.json
index 4a6f1ade7265..83032d804cb4 100644
--- a/sdk/workloads/azure-mgmt-workloads/_meta.json
+++ b/sdk/workloads/azure-mgmt-workloads/_meta.json
@@ -1,11 +1,11 @@
{
- "commit": "37f79023301bddd4f0f206665d279cbb861771e8",
+ "commit": "ca45fc1c99c890ed92aaebba149fa0440c8635a6",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
- "autorest": "3.9.2",
+ "autorest": "3.10.2",
"use": [
- "@autorest/python@6.4.0",
- "@autorest/modelerfour@4.24.3"
+ "@autorest/python@6.19.0",
+ "@autorest/modelerfour@4.27.0"
],
- "autorest_command": "autorest specification/workloads/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
+ "autorest_command": "autorest specification/workloads/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"readme": "specification/workloads/resource-manager/readme.md"
}
\ No newline at end of file
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_configuration.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_configuration.py
index 4dcf3e431c3c..14896127b82b 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_configuration.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_configuration.py
@@ -6,26 +6,19 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-import sys
from typing import Any, TYPE_CHECKING
-from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
from ._version import VERSION
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class WorkloadsMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class WorkloadsMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for WorkloadsMgmtClient.
Note that all parameters used to create this instance are saved as instance
@@ -41,8 +34,7 @@ class WorkloadsMgmtClientConfiguration(Configuration): # pylint: disable=too-ma
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(WorkloadsMgmtClientConfiguration, self).__init__(**kwargs)
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", "2023-04-01")
+ api_version: str = kwargs.pop("api_version", "2023-04-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-workloads/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -62,9 +55,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-workloads/azure/mgmt/workloads/_patch.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_patch.py
index f99e77fef986..17dbc073e01b 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_patch.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_patch.py
@@ -25,6 +25,7 @@
#
# --------------------------------------------------------------------------
+
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_serialization.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_serialization.py
index f17c068e833e..8139854b97bb 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_serialization.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_serialization.py
@@ -63,8 +63,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")
@@ -124,7 +124,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 +143,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
@@ -170,13 +172,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:
@@ -295,7 +290,7 @@ class Model(object):
_validation: Dict[str, Dict[str, Any]] = {}
def __init__(self, **kwargs: Any) -> None:
- self.additional_properties: Dict[str, Any] = {}
+ self.additional_properties: Optional[Dict[str, Any]] = {}
for k in kwargs:
if k not in self._attribute_map:
_LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__)
@@ -340,7 +335,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 +346,7 @@ 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(self, keep_readonly=keep_readonly, **kwargs) # type: ignore
def as_dict(
self,
@@ -390,7 +385,7 @@ def my_key_transformer(key, attr_desc, value):
:rtype: dict
"""
serializer = Serializer(self._infer_class_models())
- return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs)
+ return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore
@classmethod
def _infer_class_models(cls):
@@ -415,7 +410,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N
:raises: DeserializationError if something went wrong
"""
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(
@@ -445,7 +440,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):
@@ -545,7 +540,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):
self.serialize_type = {
"iso-8601": Serializer.serialize_iso,
"rfc-1123": Serializer.serialize_rfc,
@@ -561,7 +556,7 @@ 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
@@ -629,7 +624,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
if xml_desc.get("attr", False):
if xml_ns:
ET.register_namespace(xml_prefix, xml_ns)
- xml_name = "{}{}".format(xml_ns, xml_name)
+ xml_name = "{{{}}}{}".format(xml_ns, xml_name)
serialized.set(xml_name, new_attr) # type: ignore
continue
if xml_desc.get("text", False):
@@ -649,7 +644,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
@@ -662,12 +657,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
_serialized.update(_new_attr) # type: ignore
_new_attr = _new_attr[k] # type: ignore
_serialized = _serialized[k]
- except ValueError:
- continue
+ except ValueError as err:
+ if isinstance(err, SerializationError):
+ raise
except (AttributeError, KeyError, TypeError) as err:
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
- raise_with_traceback(SerializationError, msg, err)
+ raise SerializationError(msg) from err
else:
return serialized
@@ -709,7 +705,7 @@ def body(self, data, data_type, **kwargs):
]
data = deserializer._deserialize(data_type, data)
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)
@@ -729,6 +725,7 @@ 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:
@@ -741,7 +738,9 @@ def query(self, name, data, data_type, **kwargs):
:param data: The data to be serialized.
:param str data_type: The type to be serialized from.
- :rtype: str
+ :keyword bool skip_quote: Whether to skip quote the serialized result.
+ Defaults to False.
+ :rtype: str, list
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
"""
@@ -749,10 +748,8 @@ def query(self, name, data, data_type, **kwargs):
# Treat the list aside, since we don't want to encode the div separator
if data_type.startswith("["):
internal_data_type = data_type[1:-1]
- data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
- if not kwargs.get("skip_quote", False):
- data = [quote(str(d), safe="") for d in data]
- return str(self.serialize_iter(data, internal_data_type, **kwargs))
+ do_quote = not kwargs.get("skip_quote", False)
+ return 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)
@@ -803,7 +800,7 @@ def serialize_data(self, data, data_type, **kwargs):
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)
@@ -823,7 +820,7 @@ 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)
+ raise SerializationError(msg.format(data, data_type)) from err
else:
return self._serialize(data, **kwargs)
@@ -891,6 +888,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
not be None or empty.
:param str div: If set, this str will be used to combine the elements
in the iterable into a combined string. Default is 'None'.
+ :keyword bool do_quote: Whether to quote the serialized result of each iterable element.
+ Defaults to False.
:rtype: list, str
"""
if isinstance(data, str):
@@ -903,9 +902,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
for d in data:
try:
serialized.append(self.serialize_data(d, iter_type, **kwargs))
- except ValueError:
+ except ValueError as err:
+ if isinstance(err, SerializationError):
+ raise
serialized.append(None)
+ if kwargs.get("do_quote", False):
+ serialized = ["" if s is None else quote(str(s), safe="") for s in serialized]
+
if div:
serialized = ["" if s is None else str(s) for s in serialized]
serialized = div.join(serialized)
@@ -950,7 +954,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
for key, value in attr.items():
try:
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
- except ValueError:
+ except ValueError as err:
+ if isinstance(err, SerializationError):
+ raise
serialized[self.serialize_unicode(key)] = None
if "xml" in serialization_ctxt:
@@ -983,7 +989,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)
@@ -1160,10 +1166,10 @@ 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):
@@ -1199,7 +1205,6 @@ 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:])
@@ -1220,7 +1225,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:])
@@ -1271,7 +1275,7 @@ def _extract_name_from_internal_type(internal_type):
xml_name = internal_type_xml_map.get("name", internal_type.__name__)
xml_ns = internal_type_xml_map.get("ns", None)
if xml_ns:
- xml_name = "{}{}".format(xml_ns, xml_name)
+ xml_name = "{{{}}}{}".format(xml_ns, xml_name)
return xml_name
@@ -1295,7 +1299,7 @@ def xml_key_extractor(attr, attr_desc, data):
# Integrate namespace if necessary
xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None))
if xml_ns:
- xml_name = "{}{}".format(xml_ns, xml_name)
+ xml_name = "{{{}}}{}".format(xml_ns, xml_name)
# If it's an attribute, that's simple
if xml_desc.get("attr", False):
@@ -1361,7 +1365,7 @@ class Deserializer(object):
valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")
- def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
+ def __init__(self, classes: Optional[Mapping[str, type]] = None):
self.deserialize_type = {
"iso-8601": Deserializer.deserialize_iso,
"rfc-1123": Deserializer.deserialize_rfc,
@@ -1381,7 +1385,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
@@ -1434,12 +1438,12 @@ 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):
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
@@ -1471,7 +1475,7 @@ 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)
+ raise DeserializationError(msg) from err
else:
additional_properties = self._build_additional_properties(attributes, data)
return self._instantiate_model(response, d_attrs, additional_properties)
@@ -1505,14 +1509,14 @@ def _classify_target(self, target, data):
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
except AttributeError:
pass # Target is not a Model, no classify
return target, target.__class__.__name__ # type: ignore
@@ -1568,7 +1572,7 @@ 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
@@ -1642,7 +1646,7 @@ 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)
+ raise DeserializationError(msg) from err
else:
return self._deserialize(obj_type, data)
@@ -1690,7 +1694,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:
@@ -1747,7 +1751,7 @@ def deserialize_basic(self, attr, data_type):
if data_type == "bool":
if attr in [True, False, 1, 0]:
return bool(attr)
- elif isinstance(attr, basestring):
+ elif isinstance(attr, str):
if attr.lower() in ["true", "1"]:
return True
elif attr.lower() in ["false", "0"]:
@@ -1798,7 +1802,6 @@ 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:
@@ -1852,10 +1855,10 @@ def deserialize_decimal(attr):
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):
@@ -1883,7 +1886,7 @@ 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)
+ raise DeserializationError(msg) from err
else:
return duration
@@ -1900,7 +1903,7 @@ 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):
@@ -1935,7 +1938,7 @@ 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)
+ raise DeserializationError(msg) from err
else:
return date_obj
@@ -1972,7 +1975,7 @@ 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)
+ raise DeserializationError(msg) from err
else:
return date_obj
@@ -1988,9 +1991,10 @@ def deserialize_unix(attr):
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)
+ raise DeserializationError(msg) from err
else:
return date_obj
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py
index 033aad904690..dce513cbf665 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_vendor.py
@@ -6,9 +6,7 @@
# --------------------------------------------------------------------------
from abc import ABC
-from typing import List, TYPE_CHECKING, cast
-
-from azure.core.pipeline.transport import HttpRequest
+from typing import TYPE_CHECKING
from ._configuration import WorkloadsMgmtClientConfiguration
@@ -19,26 +17,6 @@
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
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
-
-
class WorkloadsMgmtClientMixinABC(ABC):
"""DO NOT use this class. It is for internal typing use only."""
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_version.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_version.py
index c47f66669f1b..e5754a47ce68 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_version.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "1.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_mgmt_client.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_mgmt_client.py
index 016dd8446686..d7ef7a9fa6ad 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_mgmt_client.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/_workloads_mgmt_client.py
@@ -8,9 +8,12 @@
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 WorkloadsMgmtClientConfiguration
@@ -35,10 +38,7 @@
class WorkloadsMgmtClient(
WorkloadsMgmtClientOperationsMixin
): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
- """Workloads client provides access to various workload operations.:code:`
`Azure Center for
- SAP solutions is currently in PREVIEW. See the `Azure Center for SAP solutions - Legal Terms
- `_
- for legal notices applicable to Azure Center for SAP solutions.
+ """Workloads client provides access to various workload operations.
:ivar sap_virtual_instances: SAPVirtualInstancesOperations operations
:vartype sap_virtual_instances: azure.mgmt.workloads.operations.SAPVirtualInstancesOperations
@@ -80,7 +80,25 @@ def __init__(
self._config = WorkloadsMgmtClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _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=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -107,7 +125,7 @@ def __init__(
)
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
@@ -127,12 +145,12 @@ 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)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "WorkloadsMgmtClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_configuration.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_configuration.py
index 485918c0c225..8f20fd6eafd3 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_configuration.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_configuration.py
@@ -6,26 +6,19 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-import sys
from typing import Any, TYPE_CHECKING
-from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class WorkloadsMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class WorkloadsMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for WorkloadsMgmtClient.
Note that all parameters used to create this instance are saved as instance
@@ -41,8 +34,7 @@ class WorkloadsMgmtClientConfiguration(Configuration): # pylint: disable=too-ma
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(WorkloadsMgmtClientConfiguration, self).__init__(**kwargs)
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", "2023-04-01")
+ api_version: str = kwargs.pop("api_version", "2023-04-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-workloads/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -62,9 +55,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-workloads/azure/mgmt/workloads/aio/_patch.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_patch.py
index f99e77fef986..17dbc073e01b 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_patch.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_patch.py
@@ -25,6 +25,7 @@
#
# --------------------------------------------------------------------------
+
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_vendor.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_vendor.py
index c3258ce1d438..0dc03e8d7d52 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_vendor.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_vendor.py
@@ -8,8 +8,6 @@
from abc import ABC
from typing import TYPE_CHECKING
-from azure.core.pipeline.transport import HttpRequest
-
from ._configuration import WorkloadsMgmtClientConfiguration
if TYPE_CHECKING:
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_mgmt_client.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_mgmt_client.py
index 5e9f97ba61a8..851d5e3a79d2 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_mgmt_client.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/_workloads_mgmt_client.py
@@ -8,9 +8,12 @@
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
@@ -35,10 +38,7 @@
class WorkloadsMgmtClient(
WorkloadsMgmtClientOperationsMixin
): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
- """Workloads client provides access to various workload operations.:code:`
`Azure Center for
- SAP solutions is currently in PREVIEW. See the `Azure Center for SAP solutions - Legal Terms
- `_
- for legal notices applicable to Azure Center for SAP solutions.
+ """Workloads client provides access to various workload operations.
:ivar sap_virtual_instances: SAPVirtualInstancesOperations operations
:vartype sap_virtual_instances:
@@ -84,7 +84,25 @@ def __init__(
self._config = WorkloadsMgmtClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _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=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -111,7 +129,9 @@ def __init__(
)
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
@@ -131,12 +151,12 @@ 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)
+ 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) -> "WorkloadsMgmtClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py
index 17de22565036..b92f9c918c3e 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_monitors_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.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
@@ -30,7 +32,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._monitors_operations import (
build_create_request,
build_delete_request,
@@ -39,12 +40,11 @@
build_list_request,
build_update_request,
)
-from .._vendor import WorkloadsMgmtClientMixinABC
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -75,7 +75,6 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Monitor"]:
Gets a list of SAP monitors in the specified subscription. The operations returns various
properties of each SAP monitor.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Monitor or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.Monitor]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -83,12 +82,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Monitor"]:
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MonitorListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -99,15 +96,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Monitor"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -119,13 +114,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("MonitorListResult", pipeline_response)
@@ -135,10 +129,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -151,8 +146,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors"}
-
@distributed_trace
def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Monitor"]:
"""Gets a list of SAP monitors.
@@ -162,7 +155,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
: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 Monitor or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.Monitor]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -170,12 +162,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MonitorListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -186,16 +176,14 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_resource_group_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -207,13 +195,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("MonitorListResult", pipeline_response)
@@ -223,10 +210,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -239,10 +227,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_by_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors"
- }
-
@distributed_trace_async
async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.Monitor:
"""Gets properties of a SAP monitor.
@@ -255,12 +239,11 @@ async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any)
:type resource_group_name: str
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Monitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.Monitor
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -271,25 +254,22 @@ async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any)
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Monitor] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
monitor_name=monitor_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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -299,21 +279,21 @@ async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Monitor", pipeline_response)
+ deserialized = self._deserialize("Monitor", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"
- }
+ return deserialized # type: ignore
async def _create_initial(
- self, resource_group_name: str, monitor_name: str, monitor_parameter: Union[_models.Monitor, IO], **kwargs: Any
- ) -> _models.Monitor:
- error_map = {
+ self,
+ resource_group_name: str,
+ monitor_name: str,
+ monitor_parameter: Union[_models.Monitor, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -324,21 +304,19 @@ async def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.Monitor] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(monitor_parameter, (IO, bytes)):
+ if isinstance(monitor_parameter, (IOBase, bytes)):
_content = monitor_parameter
else:
_json = self._serialize.body(monitor_parameter, "Monitor")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
subscription_id=self._config.subscription_id,
@@ -346,39 +324,35 @@ async def _create_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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("Monitor", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Monitor", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"
- }
-
@overload
async def begin_create(
self,
@@ -403,14 +377,6 @@ async def begin_create(
: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 Monitor or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.Monitor]
@@ -422,7 +388,7 @@ async def begin_create(
self,
resource_group_name: str,
monitor_name: str,
- monitor_parameter: IO,
+ monitor_parameter: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -437,18 +403,10 @@ async def begin_create(
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
:param monitor_parameter: Request body representing a SAP monitor. Required.
- :type monitor_parameter: IO
+ :type monitor_parameter: IO[bytes]
: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 Monitor or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.Monitor]
@@ -457,7 +415,11 @@ async def begin_create(
@distributed_trace_async
async def begin_create(
- self, resource_group_name: str, monitor_name: str, monitor_parameter: Union[_models.Monitor, IO], **kwargs: Any
+ self,
+ resource_group_name: str,
+ monitor_name: str,
+ monitor_parameter: Union[_models.Monitor, IO[bytes]],
+ **kwargs: Any
) -> AsyncLROPoller[_models.Monitor]:
"""Creates a SAP monitor.
@@ -469,19 +431,8 @@ async def begin_create(
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
:param monitor_parameter: Request body representing a SAP monitor. Is either a Monitor type or
- a IO type. Required.
- :type monitor_parameter: ~azure.mgmt.workloads.models.Monitor 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.
+ a IO[bytes] type. Required.
+ :type monitor_parameter: ~azure.mgmt.workloads.models.Monitor or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Monitor or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.Monitor]
@@ -490,9 +441,7 @@ async def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.Monitor] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
@@ -510,12 +459,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Monitor", pipeline_response)
+ deserialized = self._deserialize("Monitor", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -528,22 +478,18 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Monitor].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/monitors/{monitorName}"
- }
+ return AsyncLROPoller[_models.Monitor](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- async def _delete_initial(
- self, resource_group_name: str, monitor_name: str, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ async def _delete_initial(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -554,46 +500,42 @@ async def _delete_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
monitor_name=monitor_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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -608,14 +550,6 @@ async def begin_delete(
:type resource_group_name: str
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -624,9 +558,7 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -641,12 +573,13 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -659,17 +592,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@overload
async def update(
@@ -696,7 +627,6 @@ async def update(
: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: Monitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.Monitor
:raises ~azure.core.exceptions.HttpResponseError:
@@ -707,7 +637,7 @@ async def update(
self,
resource_group_name: str,
monitor_name: str,
- body: IO,
+ body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -723,11 +653,10 @@ async def update(
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
:param body: The Update SAP workload monitor request body. Required.
- :type body: IO
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Monitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.Monitor
:raises ~azure.core.exceptions.HttpResponseError:
@@ -735,7 +664,11 @@ async def update(
@distributed_trace_async
async def update(
- self, resource_group_name: str, monitor_name: str, body: Union[_models.UpdateMonitorRequest, IO], **kwargs: Any
+ self,
+ resource_group_name: str,
+ monitor_name: str,
+ body: Union[_models.UpdateMonitorRequest, IO[bytes]],
+ **kwargs: Any
) -> _models.Monitor:
"""Patches the Tags field of a SAP monitor.
@@ -748,17 +681,13 @@ async def update(
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
:param body: The Update SAP workload monitor request body. Is either a UpdateMonitorRequest
- type or a IO type. Required.
- :type body: ~azure.mgmt.workloads.models.UpdateMonitorRequest 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
+ type or a IO[bytes] type. Required.
+ :type body: ~azure.mgmt.workloads.models.UpdateMonitorRequest or IO[bytes]
:return: Monitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.Monitor
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -769,21 +698,19 @@ async def update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.Monitor] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
_json = self._serialize.body(body, "UpdateMonitorRequest")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
subscription_id=self._config.subscription_id,
@@ -791,15 +718,14 @@ async def update(
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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -809,13 +735,9 @@ async def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Monitor", pipeline_response)
+ deserialized = self._deserialize("Monitor", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py
index b55fa966bcda..ed3476dceb97 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +7,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,21 +20,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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 ..._vendor import _convert_request
from ...operations._operations import build_list_request
-from .._vendor import WorkloadsMgmtClientMixinABC
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -62,7 +59,6 @@ def __init__(self, *args, **kwargs) -> None:
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists all the available API operations under this PR.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -70,12 +66,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -86,14 +80,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -105,13 +97,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationListResult", pipeline_response)
@@ -121,10 +112,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -136,5 +128,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Workloads/operations"}
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py
index c4e8c9a86128..63cc537c5578 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_provider_instances_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.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
@@ -30,19 +32,17 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._provider_instances_operations import (
build_create_request,
build_delete_request,
build_get_request,
build_list_request,
)
-from .._vendor import WorkloadsMgmtClientMixinABC
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,7 +80,6 @@ def list(
:type resource_group_name: str
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ProviderInstance or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.workloads.models.ProviderInstance]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -88,12 +87,10 @@ def list(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ProviderInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -104,17 +101,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
monitor_name=monitor_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -126,13 +121,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ProviderInstanceListResult", pipeline_response)
@@ -142,10 +136,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -158,10 +153,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances"
- }
-
@distributed_trace_async
async def get(
self, resource_group_name: str, monitor_name: str, provider_instance_name: str, **kwargs: Any
@@ -178,12 +169,11 @@ async def get(
:type monitor_name: str
:param provider_instance_name: Name of the provider instance. Required.
:type provider_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ProviderInstance or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.ProviderInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -194,26 +184,23 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ProviderInstance] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
provider_instance_name=provider_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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -223,26 +210,22 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ProviderInstance", pipeline_response)
+ deserialized = self._deserialize("ProviderInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"
- }
+ return deserialized # type: ignore
async def _create_initial(
self,
resource_group_name: str,
monitor_name: str,
provider_instance_name: str,
- provider_instance_parameter: Union[_models.ProviderInstance, IO],
+ provider_instance_parameter: Union[_models.ProviderInstance, IO[bytes]],
**kwargs: Any
- ) -> _models.ProviderInstance:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -253,21 +236,19 @@ async def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.ProviderInstance] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(provider_instance_parameter, (IO, bytes)):
+ if isinstance(provider_instance_parameter, (IOBase, bytes)):
_content = provider_instance_parameter
else:
_json = self._serialize.body(provider_instance_parameter, "ProviderInstance")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
provider_instance_name=provider_instance_name,
@@ -276,39 +257,35 @@ async def _create_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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("ProviderInstance", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ProviderInstance", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"
- }
-
@overload
async def begin_create(
self,
@@ -337,14 +314,6 @@ async def begin_create(
: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 ProviderInstance or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.ProviderInstance]
@@ -357,7 +326,7 @@ async def begin_create(
resource_group_name: str,
monitor_name: str,
provider_instance_name: str,
- provider_instance_parameter: IO,
+ provider_instance_parameter: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -375,18 +344,10 @@ async def begin_create(
:param provider_instance_name: Name of the provider instance. Required.
:type provider_instance_name: str
:param provider_instance_parameter: Request body representing a provider instance. Required.
- :type provider_instance_parameter: IO
+ :type provider_instance_parameter: IO[bytes]
: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 ProviderInstance or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.ProviderInstance]
@@ -399,7 +360,7 @@ async def begin_create(
resource_group_name: str,
monitor_name: str,
provider_instance_name: str,
- provider_instance_parameter: Union[_models.ProviderInstance, IO],
+ provider_instance_parameter: Union[_models.ProviderInstance, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ProviderInstance]:
"""Creates a provider instance.
@@ -415,19 +376,8 @@ async def begin_create(
:param provider_instance_name: Name of the provider instance. Required.
:type provider_instance_name: str
:param provider_instance_parameter: Request body representing a provider instance. Is either a
- ProviderInstance type or a IO type. Required.
- :type provider_instance_parameter: ~azure.mgmt.workloads.models.ProviderInstance 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.
+ ProviderInstance type or a IO[bytes] type. Required.
+ :type provider_instance_parameter: ~azure.mgmt.workloads.models.ProviderInstance or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ProviderInstance or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.ProviderInstance]
@@ -436,9 +386,7 @@ async def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.ProviderInstance] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
@@ -457,12 +405,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ProviderInstance", pipeline_response)
+ deserialized = self._deserialize("ProviderInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -475,22 +424,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.ProviderInstance].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/monitors/{monitorName}/providerInstances/{providerInstanceName}"
- }
+ return AsyncLROPoller[_models.ProviderInstance](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
async def _delete_initial(
self, resource_group_name: str, monitor_name: str, provider_instance_name: str, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -501,47 +448,43 @@ async def _delete_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
provider_instance_name=provider_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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -559,14 +502,6 @@ async def begin_delete(
:type monitor_name: str
:param provider_instance_name: Name of the provider instance. Required.
:type provider_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -575,9 +510,7 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -593,12 +526,13 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -611,14 +545,12 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py
index 10d593acceac..613b9380fa2a 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_application_server_instances_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.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
@@ -30,7 +32,6 @@
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,
@@ -40,12 +41,11 @@
build_stop_instance_request,
build_update_request,
)
-from .._vendor import WorkloadsMgmtClientMixinABC
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -85,12 +85,11 @@ async def get(
: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.workloads.models.SAPApplicationServerInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -101,26 +100,23 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -130,26 +126,22 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response)
+ deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"
- }
+ return deserialized # type: ignore
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,
+ body: Optional[Union[_models.SAPApplicationServerInstance, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPApplicationServerInstance:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -160,16 +152,14 @@ async def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -177,7 +167,7 @@ async def _create_initial(
else:
_json = None
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
application_instance_name=application_instance_name,
@@ -186,39 +176,35 @@ async def _create_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
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,
@@ -247,14 +233,6 @@ async def begin_create(
: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:
@@ -268,7 +246,7 @@ async def begin_create(
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -286,18 +264,10 @@ async def begin_create(
Required.
:type application_instance_name: str
:param body: The SAP Application Server Instance resource request body. Default value is None.
- :type body: IO
+ :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
- :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:
@@ -311,7 +281,7 @@ async def begin_create(
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[Union[_models.SAPApplicationServerInstance, IO]] = None,
+ body: Optional[Union[_models.SAPApplicationServerInstance, IO[bytes]]] = None,
**kwargs: Any
) -> AsyncLROPoller[_models.SAPApplicationServerInstance]:
"""Puts the SAP Application Server Instance resource. :code:`
`:code:`
`This will be used by
@@ -327,19 +297,8 @@ async def begin_create(
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.workloads.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.
+ SAPApplicationServerInstance type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.SAPApplicationServerInstance or IO[bytes]
:return: An instance of AsyncLROPoller that returns either SAPApplicationServerInstance or the
result of cls(response)
:rtype:
@@ -349,9 +308,7 @@ async def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -370,12 +327,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response)
+ deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -388,27 +346,25 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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}"
- }
+ return AsyncLROPoller[_models.SAPApplicationServerInstance](
+ 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,
application_instance_name: str,
- body: Optional[Union[_models.UpdateSAPApplicationInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPApplicationInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPApplicationServerInstance:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -419,16 +375,14 @@ async def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -436,7 +390,7 @@ async def _update_initial(
else:
_json = None
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
application_instance_name=application_instance_name,
@@ -445,39 +399,35 @@ async def _update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"
- }
-
@overload
async def begin_update(
self,
@@ -505,14 +455,6 @@ async def begin_update(
: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:
@@ -526,7 +468,7 @@ async def begin_update(
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -543,18 +485,10 @@ async def begin_update(
Required.
:type application_instance_name: str
:param body: The SAP Application Server Instance resource request body. Default value is None.
- :type body: IO
+ :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
- :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:
@@ -568,7 +502,7 @@ async def begin_update(
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[Union[_models.UpdateSAPApplicationInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPApplicationInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
) -> AsyncLROPoller[_models.SAPApplicationServerInstance]:
"""Puts the SAP Application Server Instance resource.
@@ -583,19 +517,8 @@ async def begin_update(
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.workloads.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
- :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.
+ UpdateSAPApplicationInstanceRequest type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.UpdateSAPApplicationInstanceRequest or IO[bytes]
:return: An instance of AsyncLROPoller that returns either SAPApplicationServerInstance or the
result of cls(response)
:rtype:
@@ -605,9 +528,7 @@ async def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -626,12 +547,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response)
+ deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -644,22 +566,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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}/applicationInstances/{applicationInstanceName}"
- }
+ return AsyncLROPoller[_models.SAPApplicationServerInstance](
+ 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, application_instance_name: str, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -670,47 +590,43 @@ async def _delete_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -728,14 +644,6 @@ async def begin_delete(
: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 OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -744,9 +652,7 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -762,12 +668,13 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -780,17 +687,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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}"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -805,7 +710,6 @@ def list(
: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:
@@ -815,12 +719,10 @@ def list(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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 = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -831,17 +733,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -853,13 +753,12 @@ 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
+ _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)
@@ -869,10 +768,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -885,14 +785,10 @@ async def get_next(next_link=None):
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, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -903,47 +799,43 @@ async def _start_instance_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_start_instance_request(
+ _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,
- template_url=self._start_instance_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _start_instance_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_start_instance(
@@ -960,14 +852,6 @@ async def begin_start_instance(
: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 OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -976,9 +860,7 @@ async def begin_start_instance(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -994,12 +876,13 @@ async def begin_start_instance(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1012,27 +895,25 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
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,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1043,16 +924,14 @@ async def _stop_instance_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -1060,7 +939,7 @@ async def _stop_instance_initial(
else:
_json = None
- request = build_stop_instance_request(
+ _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,
@@ -1069,36 +948,34 @@ async def _stop_instance_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _stop_instance_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop"
- }
+ return deserialized # type: ignore
@overload
async def begin_stop_instance(
@@ -1127,14 +1004,6 @@ async def begin_stop_instance(
: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.workloads.models.OperationStatusResult]
@@ -1147,7 +1016,7 @@ async def begin_stop_instance(
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1164,18 +1033,10 @@ async def begin_stop_instance(
Required.
:type application_instance_name: str
:param body: SAP Application server instance stop request body. Default value is None.
- :type body: IO
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1188,7 +1049,7 @@ async def begin_stop_instance(
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[Union[_models.StopRequest, IO]] = None,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
) -> AsyncLROPoller[_models.OperationStatusResult]:
"""Stops the SAP Application Server Instance.
@@ -1203,19 +1064,8 @@ async def begin_stop_instance(
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.workloads.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.
+ a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.StopRequest or IO[bytes]
:return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1224,9 +1074,7 @@ async def begin_stop_instance(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -1245,12 +1093,13 @@ async def begin_stop_instance(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1263,14 +1112,12 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py
index 648bcd1a3389..88f907cb954a 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_central_instances_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.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
@@ -30,7 +32,6 @@
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,
@@ -40,12 +41,11 @@
build_stop_instance_request,
build_update_request,
)
-from .._vendor import WorkloadsMgmtClientMixinABC
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -84,12 +84,11 @@ async def get(
: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.workloads.models.SAPCentralServerInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,26 +99,23 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -129,26 +125,22 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response)
+ deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"
- }
+ return deserialized # type: ignore
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,
+ body: Optional[Union[_models.SAPCentralServerInstance, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPCentralServerInstance:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -159,16 +151,14 @@ async def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -176,7 +166,7 @@ async def _create_initial(
else:
_json = None
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
central_instance_name=central_instance_name,
@@ -185,39 +175,35 @@ async def _create_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
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,
@@ -246,14 +232,6 @@ async def begin_create(
: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:
@@ -267,7 +245,7 @@ async def begin_create(
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -285,18 +263,10 @@ async def begin_create(
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
+ :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
- :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:
@@ -310,7 +280,7 @@ async def begin_create(
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[Union[_models.SAPCentralServerInstance, IO]] = None,
+ body: Optional[Union[_models.SAPCentralServerInstance, IO[bytes]]] = None,
**kwargs: Any
) -> AsyncLROPoller[_models.SAPCentralServerInstance]:
"""Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used
@@ -326,19 +296,8 @@ async def begin_create(
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.workloads.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.
+ SAPCentralServerInstance type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.SAPCentralServerInstance or IO[bytes]
:return: An instance of AsyncLROPoller that returns either SAPCentralServerInstance or the
result of cls(response)
:rtype:
@@ -348,9 +307,7 @@ async def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -369,12 +326,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response)
+ deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -387,27 +345,25 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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}"
- }
+ return AsyncLROPoller[_models.SAPCentralServerInstance](
+ 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,
central_instance_name: str,
- body: Optional[Union[_models.UpdateSAPCentralInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPCentralInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPCentralServerInstance:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -418,16 +374,14 @@ async def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -435,7 +389,7 @@ async def _update_initial(
else:
_json = None
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
central_instance_name=central_instance_name,
@@ -444,39 +398,35 @@ async def _update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"
- }
-
@overload
async def begin_update(
self,
@@ -505,14 +455,6 @@ async def begin_update(
: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:
@@ -526,7 +468,7 @@ async def begin_update(
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -544,18 +486,10 @@ async def begin_update(
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
+ :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
- :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:
@@ -569,7 +503,7 @@ async def begin_update(
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[Union[_models.UpdateSAPCentralInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPCentralInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
) -> AsyncLROPoller[_models.SAPCentralServerInstance]:
"""Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to
@@ -585,19 +519,8 @@ async def begin_update(
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.workloads.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
- :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.
+ UpdateSAPCentralInstanceRequest type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.UpdateSAPCentralInstanceRequest or IO[bytes]
:return: An instance of AsyncLROPoller that returns either SAPCentralServerInstance or the
result of cls(response)
:rtype:
@@ -607,9 +530,7 @@ async def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -628,12 +549,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response)
+ deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -646,22 +568,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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}/centralInstances/{centralInstanceName}"
- }
+ return AsyncLROPoller[_models.SAPCentralServerInstance](
+ 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, central_instance_name: str, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -672,47 +592,43 @@ async def _delete_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -732,14 +648,6 @@ async def begin_delete(
: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 OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -748,9 +656,7 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -766,12 +672,13 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -784,17 +691,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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}"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -809,7 +714,6 @@ def list(
: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:
@@ -819,12 +723,10 @@ def list(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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 = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -835,17 +737,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -857,13 +757,12 @@ 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
+ _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)
@@ -873,10 +772,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -889,14 +789,10 @@ async def get_next(next_link=None):
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, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -907,47 +803,43 @@ async def _start_instance_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_start_instance_request(
+ _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,
- template_url=self._start_instance_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _start_instance_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_start_instance(
@@ -964,14 +856,6 @@ async def begin_start_instance(
: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 OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -980,9 +864,7 @@ async def begin_start_instance(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -998,12 +880,13 @@ async def begin_start_instance(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1016,27 +899,25 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
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,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1047,16 +928,14 @@ async def _stop_instance_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -1064,7 +943,7 @@ async def _stop_instance_initial(
else:
_json = None
- request = build_stop_instance_request(
+ _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,
@@ -1073,36 +952,34 @@ async def _stop_instance_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _stop_instance_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop"
- }
+ return deserialized # type: ignore
@overload
async def begin_stop_instance(
@@ -1131,14 +1008,6 @@ async def begin_stop_instance(
: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.workloads.models.OperationStatusResult]
@@ -1151,7 +1020,7 @@ async def begin_stop_instance(
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1168,18 +1037,10 @@ async def begin_stop_instance(
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
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1192,7 +1053,7 @@ async def begin_stop_instance(
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[Union[_models.StopRequest, IO]] = None,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
) -> AsyncLROPoller[_models.OperationStatusResult]:
"""Stops the SAP Central Services Instance.
@@ -1207,19 +1068,8 @@ async def begin_stop_instance(
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.workloads.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.
+ IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.StopRequest or IO[bytes]
:return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1228,9 +1078,7 @@ async def begin_stop_instance(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -1249,12 +1097,13 @@ async def begin_stop_instance(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1267,14 +1116,12 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py
index 2b71cf1d6b54..023289286fb5 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_database_instances_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.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
@@ -30,7 +32,6 @@
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,
@@ -40,12 +41,11 @@
build_stop_instance_request,
build_update_request,
)
-from .._vendor import WorkloadsMgmtClientMixinABC
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -84,12 +84,11 @@ async def get(
: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.workloads.models.SAPDatabaseInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,26 +99,23 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -129,26 +125,22 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response)
+ deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"
- }
+ return deserialized # type: ignore
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,
+ body: Optional[Union[_models.SAPDatabaseInstance, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPDatabaseInstance:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -159,16 +151,14 @@ async def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -176,7 +166,7 @@ async def _create_initial(
else:
_json = None
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
database_instance_name=database_instance_name,
@@ -185,39 +175,35 @@ async def _create_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
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,
@@ -247,14 +233,6 @@ async def begin_create(
: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.workloads.models.SAPDatabaseInstance]
@@ -267,7 +245,7 @@ async def begin_create(
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -286,18 +264,10 @@ async def begin_create(
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
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either SAPDatabaseInstance or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance]
@@ -310,7 +280,7 @@ async def begin_create(
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[Union[_models.SAPDatabaseInstance, IO]] = None,
+ body: Optional[Union[_models.SAPDatabaseInstance, IO[bytes]]] = None,
**kwargs: Any
) -> AsyncLROPoller[_models.SAPDatabaseInstance]:
"""Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource.
@@ -327,19 +297,8 @@ async def begin_create(
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.workloads.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.
+ type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.SAPDatabaseInstance or IO[bytes]
:return: An instance of AsyncLROPoller that returns either SAPDatabaseInstance or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance]
@@ -348,9 +307,7 @@ async def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -369,12 +326,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response)
+ deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -387,27 +345,25 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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}"
- }
+ return AsyncLROPoller[_models.SAPDatabaseInstance](
+ 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,
database_instance_name: str,
- body: Optional[Union[_models.UpdateSAPDatabaseInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPDatabaseInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPDatabaseInstance:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -418,16 +374,14 @@ async def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -435,7 +389,7 @@ async def _update_initial(
else:
_json = None
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
database_instance_name=database_instance_name,
@@ -444,39 +398,35 @@ async def _update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"
- }
-
@overload
async def begin_update(
self,
@@ -504,14 +454,6 @@ async def begin_update(
: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.workloads.models.SAPDatabaseInstance]
@@ -524,7 +466,7 @@ async def begin_update(
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -541,18 +483,10 @@ async def begin_update(
generation to work correctly. Required.
:type database_instance_name: str
:param body: Database resource update request body. Default value is None.
- :type body: IO
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either SAPDatabaseInstance or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance]
@@ -565,7 +499,7 @@ async def begin_update(
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[Union[_models.UpdateSAPDatabaseInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPDatabaseInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
) -> AsyncLROPoller[_models.SAPDatabaseInstance]:
"""Updates the Database resource.
@@ -580,19 +514,8 @@ async def begin_update(
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.workloads.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
- :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.
+ UpdateSAPDatabaseInstanceRequest type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.UpdateSAPDatabaseInstanceRequest or IO[bytes]
:return: An instance of AsyncLROPoller that returns either SAPDatabaseInstance or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance]
@@ -601,9 +524,7 @@ async def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -622,12 +543,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response)
+ deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -640,22 +562,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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}/databaseInstances/{databaseInstanceName}"
- }
+ return AsyncLROPoller[_models.SAPDatabaseInstance](
+ 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, database_instance_name: str, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -666,47 +586,43 @@ async def _delete_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -725,14 +641,6 @@ async def begin_delete(
: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 OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -741,9 +649,7 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -759,12 +665,13 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -777,17 +684,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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}"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -801,7 +706,6 @@ def list(
: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.workloads.models.SAPDatabaseInstance]
@@ -810,12 +714,10 @@ def list(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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 = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -826,17 +728,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -848,13 +748,12 @@ 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
+ _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)
@@ -864,10 +763,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -880,14 +780,10 @@ async def get_next(next_link=None):
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, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -898,47 +794,43 @@ async def _start_instance_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_start_instance_request(
+ _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,
- template_url=self._start_instance_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _start_instance_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_start_instance(
@@ -955,14 +847,6 @@ async def begin_start_instance(
: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 OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -971,9 +855,7 @@ async def begin_start_instance(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -989,12 +871,13 @@ async def begin_start_instance(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1007,27 +890,25 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
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,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1038,16 +919,14 @@ async def _stop_instance_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -1055,7 +934,7 @@ async def _stop_instance_initial(
else:
_json = None
- request = build_stop_instance_request(
+ _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,
@@ -1064,36 +943,34 @@ async def _stop_instance_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _stop_instance_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop"
- }
+ return deserialized # type: ignore
@overload
async def begin_stop_instance(
@@ -1122,14 +999,6 @@ async def begin_stop_instance(
: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.workloads.models.OperationStatusResult]
@@ -1142,7 +1011,7 @@ async def begin_stop_instance(
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1159,18 +1028,10 @@ async def begin_stop_instance(
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
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1183,7 +1044,7 @@ async def begin_stop_instance(
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[Union[_models.StopRequest, IO]] = None,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
) -> AsyncLROPoller[_models.OperationStatusResult]:
"""Stops the database instance of the SAP system.
@@ -1198,19 +1059,8 @@ async def begin_stop_instance(
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.workloads.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.
+ type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.StopRequest or IO[bytes]
:return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1219,9 +1069,7 @@ async def begin_stop_instance(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -1240,12 +1088,13 @@ async def begin_stop_instance(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1258,14 +1107,12 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_landscape_monitor_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_landscape_monitor_operations.py
index b3ea8697d095..c564f037e72a 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_landscape_monitor_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_landscape_monitor_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,14 +19,12 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._sap_landscape_monitor_operations import (
build_create_request,
build_delete_request,
@@ -33,12 +32,11 @@
build_list_request,
build_update_request,
)
-from .._vendor import WorkloadsMgmtClientMixinABC
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -74,12 +72,11 @@ async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any)
:type resource_group_name: str
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -90,25 +87,22 @@ async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any)
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SapLandscapeMonitor] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
monitor_name=monitor_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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -118,16 +112,12 @@ async def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response)
+ deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default"
- }
+ return deserialized # type: ignore
@overload
async def create(
@@ -155,7 +145,6 @@ async def create(
: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: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
@@ -166,7 +155,7 @@ async def create(
self,
resource_group_name: str,
monitor_name: str,
- sap_landscape_monitor_parameter: IO,
+ sap_landscape_monitor_parameter: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -183,11 +172,10 @@ async def create(
:type monitor_name: str
:param sap_landscape_monitor_parameter: Request body representing a configuration for Sap
Landscape Monitor Dashboard. Required.
- :type sap_landscape_monitor_parameter: IO
+ :type sap_landscape_monitor_parameter: IO[bytes]
: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: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
@@ -198,7 +186,7 @@ async def create(
self,
resource_group_name: str,
monitor_name: str,
- sap_landscape_monitor_parameter: Union[_models.SapLandscapeMonitor, IO],
+ sap_landscape_monitor_parameter: Union[_models.SapLandscapeMonitor, IO[bytes]],
**kwargs: Any
) -> _models.SapLandscapeMonitor:
"""Creates a SAP Landscape Monitor Dashboard.
@@ -212,17 +200,15 @@ async def create(
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
:param sap_landscape_monitor_parameter: Request body representing a configuration for Sap
- Landscape Monitor Dashboard. Is either a SapLandscapeMonitor type or a IO type. Required.
- :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor 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
+ Landscape Monitor Dashboard. Is either a SapLandscapeMonitor type or a IO[bytes] type.
+ Required.
+ :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor or
+ IO[bytes]
:return: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -233,21 +219,19 @@ async def create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.SapLandscapeMonitor] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(sap_landscape_monitor_parameter, (IO, bytes)):
+ if isinstance(sap_landscape_monitor_parameter, (IOBase, bytes)):
_content = sap_landscape_monitor_parameter
else:
_json = self._serialize.body(sap_landscape_monitor_parameter, "SapLandscapeMonitor")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
subscription_id=self._config.subscription_id,
@@ -255,15 +239,14 @@ async def create(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -273,21 +256,13 @@ async def create(
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("SapLandscapeMonitor", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response)
+ deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default"
- }
-
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, monitor_name: str, **kwargs: Any
@@ -302,12 +277,11 @@ async def delete( # pylint: disable=inconsistent-return-statements
:type resource_group_name: str
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -318,25 +292,22 @@ async def delete( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -347,11 +318,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
async def update(
@@ -379,7 +346,6 @@ async def update(
: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: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
@@ -390,7 +356,7 @@ async def update(
self,
resource_group_name: str,
monitor_name: str,
- sap_landscape_monitor_parameter: IO,
+ sap_landscape_monitor_parameter: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -407,11 +373,10 @@ async def update(
:type monitor_name: str
:param sap_landscape_monitor_parameter: Request body representing a configuration for Sap
Landscape Monitor Dashboard. Required.
- :type sap_landscape_monitor_parameter: IO
+ :type sap_landscape_monitor_parameter: IO[bytes]
: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: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
@@ -422,7 +387,7 @@ async def update(
self,
resource_group_name: str,
monitor_name: str,
- sap_landscape_monitor_parameter: Union[_models.SapLandscapeMonitor, IO],
+ sap_landscape_monitor_parameter: Union[_models.SapLandscapeMonitor, IO[bytes]],
**kwargs: Any
) -> _models.SapLandscapeMonitor:
"""Patches the SAP Landscape Monitor Dashboard.
@@ -436,17 +401,15 @@ async def update(
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
:param sap_landscape_monitor_parameter: Request body representing a configuration for Sap
- Landscape Monitor Dashboard. Is either a SapLandscapeMonitor type or a IO type. Required.
- :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor 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
+ Landscape Monitor Dashboard. Is either a SapLandscapeMonitor type or a IO[bytes] type.
+ Required.
+ :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor or
+ IO[bytes]
:return: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -457,21 +420,19 @@ async def update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.SapLandscapeMonitor] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(sap_landscape_monitor_parameter, (IO, bytes)):
+ if isinstance(sap_landscape_monitor_parameter, (IOBase, bytes)):
_content = sap_landscape_monitor_parameter
else:
_json = self._serialize.body(sap_landscape_monitor_parameter, "SapLandscapeMonitor")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
subscription_id=self._config.subscription_id,
@@ -479,15 +440,14 @@ async def update(
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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -497,16 +457,12 @@ async def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response)
+ deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def list(
@@ -522,12 +478,11 @@ async def list(
:type resource_group_name: str
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SapLandscapeMonitorListResult or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitorListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -538,25 +493,22 @@ async def list(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SapLandscapeMonitorListResult] = kwargs.pop("cls", None)
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
monitor_name=monitor_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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -566,13 +518,9 @@ async def list(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SapLandscapeMonitorListResult", pipeline_response)
+ deserialized = self._deserialize("SapLandscapeMonitorListResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor"
- }
+ return deserialized # type: ignore
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py
index f0c90a3b779e..b825de51d471 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_sap_virtual_instances_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.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
@@ -30,7 +32,6 @@
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,
@@ -41,12 +42,11 @@
build_stop_request,
build_update_request,
)
-from .._vendor import WorkloadsMgmtClientMixinABC
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -74,10 +74,10 @@ async def _create_initial(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[Union[_models.SAPVirtualInstance, IO]] = None,
+ body: Optional[Union[_models.SAPVirtualInstance, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPVirtualInstance:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -88,16 +88,14 @@ async def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -105,7 +103,7 @@ async def _create_initial(
else:
_json = None
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
subscription_id=self._config.subscription_id,
@@ -113,39 +111,35 @@ async def _create_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
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,
@@ -169,14 +163,6 @@ async def begin_create(
: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.workloads.models.SAPVirtualInstance]
@@ -188,7 +174,7 @@ async def begin_create(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -202,18 +188,10 @@ async def begin_create(
Required.
:type sap_virtual_instance_name: str
:param body: Virtual Instance for SAP solutions resource request body. Default value is None.
- :type body: IO
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPVirtualInstance]
@@ -225,7 +203,7 @@ async def begin_create(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[Union[_models.SAPVirtualInstance, IO]] = None,
+ body: Optional[Union[_models.SAPVirtualInstance, IO[bytes]]] = None,
**kwargs: Any
) -> AsyncLROPoller[_models.SAPVirtualInstance]:
"""Creates a Virtual Instance for SAP solutions (VIS) resource.
@@ -237,19 +215,8 @@ async def begin_create(
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.workloads.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.
+ SAPVirtualInstance type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.SAPVirtualInstance or IO[bytes]
:return: An instance of AsyncLROPoller that returns either SAPVirtualInstance or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.SAPVirtualInstance]
@@ -258,9 +225,7 @@ async def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -278,12 +243,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPVirtualInstance", pipeline_response)
+ deserialized = self._deserialize("SAPVirtualInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -296,17 +262,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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}"
- }
+ return AsyncLROPoller[_models.SAPVirtualInstance](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace_async
async def get(
@@ -320,12 +284,11 @@ async def get(
: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.workloads.models.SAPVirtualInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -336,25 +299,22 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -364,16 +324,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPVirtualInstance", pipeline_response)
+ deserialized = self._deserialize("SAPVirtualInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"
- }
+ return deserialized # type: ignore
@overload
async def update(
@@ -399,7 +355,6 @@ async def update(
: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: SAPVirtualInstance or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -410,7 +365,7 @@ async def update(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -425,11 +380,10 @@ async def update(
: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
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SAPVirtualInstance or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -440,7 +394,7 @@ async def update(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[Union[_models.UpdateSAPVirtualInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPVirtualInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
) -> _models.SAPVirtualInstance:
"""Updates a Virtual Instance for SAP solutions resource.
@@ -452,17 +406,13 @@ async def update(
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.workloads.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
+ UpdateSAPVirtualInstanceRequest type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.UpdateSAPVirtualInstanceRequest or IO[bytes]
:return: SAPVirtualInstance or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -473,16 +423,14 @@ async def update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -490,7 +438,7 @@ async def update(
else:
_json = None
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
subscription_id=self._config.subscription_id,
@@ -498,15 +446,14 @@ async def update(
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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -516,21 +463,17 @@ async def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPVirtualInstance", pipeline_response)
+ deserialized = self._deserialize("SAPVirtualInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"
- }
+ return deserialized # type: ignore
async def _delete_initial(
self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -541,46 +484,42 @@ async def _delete_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -595,14 +534,6 @@ async def begin_delete(
: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 OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -611,9 +542,7 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -628,12 +557,13 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -646,17 +576,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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}"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list_by_resource_group(
@@ -667,7 +595,6 @@ def list_by_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.workloads.models.SAPVirtualInstance]
@@ -676,12 +603,10 @@ def list_by_resource_group(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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 = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -692,16 +617,14 @@ def list_by_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_resource_group_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -713,13 +636,12 @@ 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
+ _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)
@@ -729,10 +651,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -745,15 +668,10 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_by_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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.workloads.models.SAPVirtualInstance]
@@ -762,12 +680,10 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SAPVirtu
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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 = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -778,15 +694,13 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SAPVirtu
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_subscription_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -798,13 +712,12 @@ 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
+ _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)
@@ -814,10 +727,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -830,14 +744,10 @@ async def get_next(next_link=None):
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, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -848,46 +758,42 @@ async def _start_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_start_request(
+ _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,
- template_url=self._start_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _start_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_start(
@@ -902,14 +808,6 @@ async def begin_start(
: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 OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -918,9 +816,7 @@ async def begin_start(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -935,12 +831,13 @@ async def begin_start(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -953,26 +850,24 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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"
- }
+ 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, IO]] = None,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -983,16 +878,14 @@ async def _stop_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -1000,7 +893,7 @@ async def _stop_initial(
else:
_json = None
- request = build_stop_request(
+ _request = build_stop_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
subscription_id=self._config.subscription_id,
@@ -1008,36 +901,34 @@ async def _stop_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _stop_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop"
- }
+ return deserialized # type: ignore
@overload
async def begin_stop(
@@ -1064,14 +955,6 @@ async def begin_stop(
: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.workloads.models.OperationStatusResult]
@@ -1083,7 +966,7 @@ async def begin_stop(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1099,18 +982,10 @@ async def begin_stop(
: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
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1122,7 +997,7 @@ async def begin_stop(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[Union[_models.StopRequest, IO]] = None,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
) -> AsyncLROPoller[_models.OperationStatusResult]:
"""Stops the SAP Application, that is the Application server instances and Central Services
@@ -1135,19 +1010,8 @@ async def begin_stop(
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.workloads.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.
+ StopRequest type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.StopRequest or IO[bytes]
:return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1156,9 +1020,7 @@ async def begin_stop(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -1176,12 +1038,13 @@ async def begin_stop(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1194,14 +1057,12 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_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(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"
- }
+ return AsyncLROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_mgmt_client_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_mgmt_client_operations.py
index e8bb5bced3ce..893a3b4c5fde 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_mgmt_client_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/aio/operations/_workloads_mgmt_client_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,14 +19,12 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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_mgmt_client_operations import (
build_sap_availability_zone_details_request,
build_sap_disk_configurations_request,
@@ -34,15 +33,16 @@
)
from .._vendor import WorkloadsMgmtClientMixinABC
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class WorkloadsMgmtClientOperationsMixin(WorkloadsMgmtClientMixinABC):
+
@overload
async def sap_sizing_recommendations(
self,
@@ -63,7 +63,6 @@ async def sap_sizing_recommendations(
: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.workloads.models.SAPSizingRecommendationResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -73,7 +72,7 @@ async def sap_sizing_recommendations(
async def sap_sizing_recommendations(
self,
location: str,
- sap_sizing_recommendation: Optional[IO] = None,
+ sap_sizing_recommendation: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -85,11 +84,10 @@ async def sap_sizing_recommendations(
:type location: str
:param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is
None.
- :type sap_sizing_recommendation: IO
+ :type sap_sizing_recommendation: IO[bytes]
: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.workloads.models.SAPSizingRecommendationResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -99,7 +97,7 @@ async def sap_sizing_recommendations(
async def sap_sizing_recommendations(
self,
location: str,
- sap_sizing_recommendation: Optional[Union[_models.SAPSizingRecommendationRequest, IO]] = None,
+ sap_sizing_recommendation: Optional[Union[_models.SAPSizingRecommendationRequest, IO[bytes]]] = None,
**kwargs: Any
) -> _models.SAPSizingRecommendationResult:
"""Get SAP sizing recommendations by providing input SAPS for application tier and memory required
@@ -108,18 +106,14 @@ async def sap_sizing_recommendations(
: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.
+ SAPSizingRecommendationRequest type or a IO[bytes] type. Default value is None.
:type sap_sizing_recommendation: ~azure.mgmt.workloads.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
+ IO[bytes]
:return: SAPSizingRecommendationResult or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPSizingRecommendationResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -130,16 +124,14 @@ async def sap_sizing_recommendations(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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, (IO, bytes)):
+ if isinstance(sap_sizing_recommendation, (IOBase, bytes)):
_content = sap_sizing_recommendation
else:
if sap_sizing_recommendation is not None:
@@ -147,22 +139,21 @@ async def sap_sizing_recommendations(
else:
_json = None
- request = build_sap_sizing_recommendations_request(
+ _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)
+ _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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -172,16 +163,12 @@ async def sap_sizing_recommendations(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPSizingRecommendationResult", pipeline_response)
+ deserialized = self._deserialize("SAPSizingRecommendationResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- sap_sizing_recommendations.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations"
- }
+ return deserialized # type: ignore
@overload
async def sap_supported_sku(
@@ -201,7 +188,6 @@ async def sap_supported_sku(
: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.workloads.models.SAPSupportedResourceSkusResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -211,7 +197,7 @@ async def sap_supported_sku(
async def sap_supported_sku(
self,
location: str,
- sap_supported_sku: Optional[IO] = None,
+ sap_supported_sku: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -221,11 +207,10 @@ async def sap_supported_sku(
: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
+ :type sap_supported_sku: IO[bytes]
: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.workloads.models.SAPSupportedResourceSkusResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -235,7 +220,7 @@ async def sap_supported_sku(
async def sap_supported_sku(
self,
location: str,
- sap_supported_sku: Optional[Union[_models.SAPSupportedSkusRequest, IO]] = None,
+ sap_supported_sku: Optional[Union[_models.SAPSupportedSkusRequest, IO[bytes]]] = None,
**kwargs: Any
) -> _models.SAPSupportedResourceSkusResult:
"""Get a list of SAP supported SKUs for ASCS, Application and Database tier.
@@ -243,17 +228,13 @@ async def sap_supported_sku(
: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.workloads.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
+ type or a IO[bytes] type. Default value is None.
+ :type sap_supported_sku: ~azure.mgmt.workloads.models.SAPSupportedSkusRequest or IO[bytes]
:return: SAPSupportedResourceSkusResult or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPSupportedResourceSkusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -264,16 +245,14 @@ async def sap_supported_sku(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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, (IO, bytes)):
+ if isinstance(sap_supported_sku, (IOBase, bytes)):
_content = sap_supported_sku
else:
if sap_supported_sku is not None:
@@ -281,22 +260,21 @@ async def sap_supported_sku(
else:
_json = None
- request = build_sap_supported_sku_request(
+ _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)
+ _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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -306,16 +284,12 @@ async def sap_supported_sku(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPSupportedResourceSkusResult", pipeline_response)
+ deserialized = self._deserialize("SAPSupportedResourceSkusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- sap_supported_sku.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku"
- }
+ return deserialized # type: ignore
@overload
async def sap_disk_configurations(
@@ -335,7 +309,6 @@ async def sap_disk_configurations(
: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.workloads.models.SAPDiskConfigurationsResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -345,7 +318,7 @@ async def sap_disk_configurations(
async def sap_disk_configurations(
self,
location: str,
- sap_disk_configurations: Optional[IO] = None,
+ sap_disk_configurations: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -355,11 +328,10 @@ async def sap_disk_configurations(
: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
+ :type sap_disk_configurations: IO[bytes]
: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.workloads.models.SAPDiskConfigurationsResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -369,7 +341,7 @@ async def sap_disk_configurations(
async def sap_disk_configurations(
self,
location: str,
- sap_disk_configurations: Optional[Union[_models.SAPDiskConfigurationsRequest, IO]] = None,
+ sap_disk_configurations: Optional[Union[_models.SAPDiskConfigurationsRequest, IO[bytes]]] = None,
**kwargs: Any
) -> _models.SAPDiskConfigurationsResult:
"""Get the SAP Disk Configuration Layout prod/non-prod SAP System.
@@ -377,17 +349,14 @@ async def sap_disk_configurations(
: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.workloads.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
+ SAPDiskConfigurationsRequest type or a IO[bytes] type. Default value is None.
+ :type sap_disk_configurations: ~azure.mgmt.workloads.models.SAPDiskConfigurationsRequest or
+ IO[bytes]
:return: SAPDiskConfigurationsResult or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPDiskConfigurationsResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -398,16 +367,14 @@ async def sap_disk_configurations(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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, (IO, bytes)):
+ if isinstance(sap_disk_configurations, (IOBase, bytes)):
_content = sap_disk_configurations
else:
if sap_disk_configurations is not None:
@@ -415,22 +382,21 @@ async def sap_disk_configurations(
else:
_json = None
- request = build_sap_disk_configurations_request(
+ _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)
+ _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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -440,16 +406,12 @@ async def sap_disk_configurations(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPDiskConfigurationsResult", pipeline_response)
+ deserialized = self._deserialize("SAPDiskConfigurationsResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- sap_disk_configurations.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations"
- }
+ return deserialized # type: ignore
@overload
async def sap_availability_zone_details(
@@ -471,7 +433,6 @@ async def sap_availability_zone_details(
: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.workloads.models.SAPAvailabilityZoneDetailsResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -481,7 +442,7 @@ async def sap_availability_zone_details(
async def sap_availability_zone_details(
self,
location: str,
- sap_availability_zone_details: Optional[IO] = None,
+ sap_availability_zone_details: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -492,11 +453,10 @@ async def sap_availability_zone_details(
:type location: str
:param sap_availability_zone_details: SAP Availability Zone Details Request body. Default value
is None.
- :type sap_availability_zone_details: IO
+ :type sap_availability_zone_details: IO[bytes]
: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.workloads.models.SAPAvailabilityZoneDetailsResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -506,7 +466,7 @@ async def sap_availability_zone_details(
async def sap_availability_zone_details(
self,
location: str,
- sap_availability_zone_details: Optional[Union[_models.SAPAvailabilityZoneDetailsRequest, IO]] = None,
+ sap_availability_zone_details: Optional[Union[_models.SAPAvailabilityZoneDetailsRequest, IO[bytes]]] = None,
**kwargs: Any
) -> _models.SAPAvailabilityZoneDetailsResult:
"""Get the recommended SAP Availability Zone Pair Details for your region.
@@ -514,18 +474,14 @@ async def sap_availability_zone_details(
: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.
+ SAPAvailabilityZoneDetailsRequest type or a IO[bytes] type. Default value is None.
:type sap_availability_zone_details:
- ~azure.mgmt.workloads.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
+ ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsRequest or IO[bytes]
:return: SAPAvailabilityZoneDetailsResult or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -536,16 +492,14 @@ async def sap_availability_zone_details(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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, (IO, bytes)):
+ if isinstance(sap_availability_zone_details, (IOBase, bytes)):
_content = sap_availability_zone_details
else:
if sap_availability_zone_details is not None:
@@ -553,22 +507,21 @@ async def sap_availability_zone_details(
else:
_json = None
- request = build_sap_availability_zone_details_request(
+ _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)
+ _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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -578,13 +531,9 @@ async def sap_availability_zone_details(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPAvailabilityZoneDetailsResult", pipeline_response)
+ deserialized = self._deserialize("SAPAvailabilityZoneDetailsResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- sap_availability_zone_details.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails"
- }
+ return deserialized # type: ignore
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py
index 1fcc745d36bc..429fe7e392cb 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/models/_models_py3.py
@@ -20,7 +20,7 @@
class ApplicationServerConfiguration(_serialization.Model):
"""Gets or sets the application server configuration.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar subnet_id: The subnet id. Required.
:vartype subnet_id: str
@@ -140,7 +140,7 @@ def __init__(self, **kwargs: Any) -> None:
class CentralServerConfiguration(_serialization.Model):
"""Gets or sets the central server configuration.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar subnet_id: The subnet id. Required.
:vartype subnet_id: str
@@ -278,7 +278,7 @@ class FileShareConfiguration(_serialization.Model):
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.
+ All required parameters must be populated in order to send to server.
:ivar configuration_type: The type of file share config. Required. Known values are: "Skip",
"CreateAndMount", and "Mount".
@@ -313,7 +313,7 @@ class CreateAndMountFileShareConfiguration(FileShareConfiguration):
to place the transport directory in. The storage account and fileshare will be auto-created by
the ACSS and doesn’t need to pre-created.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar configuration_type: The type of file share config. Required. Known values are: "Skip",
"CreateAndMount", and "Mount".
@@ -356,7 +356,7 @@ def __init__(
class DatabaseConfiguration(_serialization.Model):
"""Gets or sets the database configuration.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar database_type: The database type. Known values are: "HANA" and "DB2".
:vartype database_type: str or ~azure.mgmt.workloads.models.SAPDatabaseType
@@ -506,7 +506,7 @@ class ProviderSpecificProperties(_serialization.Model):
PrometheusHaClusterProviderInstanceProperties, PrometheusOSProviderInstanceProperties,
HanaDbProviderInstanceProperties, SapNetWeaverProviderInstanceProperties
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar provider_type: The provider type. For example, the value can be SapHana. Required.
:vartype provider_type: str
@@ -540,7 +540,7 @@ def __init__(self, **kwargs: Any) -> None:
class DB2ProviderInstanceProperties(ProviderSpecificProperties):
"""Gets or sets the DB2 provider properties.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar provider_type: The provider type. For example, the value can be SapHana. Required.
:vartype provider_type: str
@@ -663,7 +663,7 @@ class SAPConfiguration(_serialization.Model):
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.
+ All required parameters must be populated in order to send to server.
:ivar configuration_type: The configuration Type. Required. Known values are: "Deployment",
"Discovery", and "DeploymentWithOSConfig".
@@ -695,7 +695,7 @@ def __init__(self, **kwargs: Any) -> None:
class DeploymentConfiguration(SAPConfiguration):
"""Deployment Configuration.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar configuration_type: The configuration Type. Required. Known values are: "Deployment",
"Discovery", and "DeploymentWithOSConfig".
@@ -746,7 +746,7 @@ def __init__(
class DeploymentWithOSConfiguration(SAPConfiguration):
"""Deployment along with OS Configuration.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar configuration_type: The configuration Type. Required. Known values are: "Deployment",
"Discovery", and "DeploymentWithOSConfig".
@@ -806,7 +806,7 @@ class DiscoveryConfiguration(SAPConfiguration):
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.
+ All required parameters must be populated in order to send to server.
:ivar configuration_type: The configuration Type. Required. Known values are: "Deployment",
"Discovery", and "DeploymentWithOSConfig".
@@ -816,7 +816,7 @@ class DiscoveryConfiguration(SAPConfiguration):
: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
+ `_.: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.
@@ -849,7 +849,7 @@ def __init__(
: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
+ `_.:code:`
`:code:`
`If # pylint: disable=line-too-long
not provided, the service will create the storage account with a random name.
:paramtype managed_rg_storage_account_name: str
"""
@@ -1311,7 +1311,7 @@ class SoftwareConfiguration(_serialization.Model):
ExternalInstallationSoftwareConfiguration, SAPInstallWithoutOSConfigSoftwareConfiguration,
ServiceInitiatedSoftwareConfiguration
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar software_installation_type: The SAP software installation Type. Required. Known values
are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External".
@@ -1341,11 +1341,11 @@ def __init__(self, **kwargs: Any) -> None:
self.software_installation_type: Optional[str] = None
-class ExternalInstallationSoftwareConfiguration(SoftwareConfiguration):
+class ExternalInstallationSoftwareConfiguration(SoftwareConfiguration): # pylint: disable=name-too-long
"""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.
+ All required parameters must be populated in order to send to server.
:ivar software_installation_type: The SAP software installation Type. Required. Known values
are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External".
@@ -1408,7 +1408,7 @@ def __init__(self, **kwargs: Any) -> None:
class HanaDbProviderInstanceProperties(ProviderSpecificProperties): # pylint: disable=too-many-instance-attributes
"""Gets or sets the provider properties.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar provider_type: The provider type. For example, the value can be SapHana. Required.
:vartype provider_type: str
@@ -1515,7 +1515,7 @@ def __init__(
class HighAvailabilityConfiguration(_serialization.Model):
"""Gets or sets the high availability configuration.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar high_availability_type: The high availability type. Required. Known values are:
"AvailabilitySet" and "AvailabilityZone".
@@ -1543,7 +1543,7 @@ def __init__(self, *, high_availability_type: Union[str, "_models.SAPHighAvailab
class HighAvailabilitySoftwareConfiguration(_serialization.Model):
"""Gets or sets the HA software configuration.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar fencing_client_id: The fencing client id. Required.
:vartype fencing_client_id: str
@@ -1641,7 +1641,7 @@ class InfrastructureConfiguration(_serialization.Model):
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.
+ All required parameters must be populated in order to send to server.
:ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known
values are: "SingleServer" and "ThreeTier".
@@ -1682,7 +1682,7 @@ class OSConfiguration(_serialization.Model):
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.
+ All required parameters must be populated in order to send to server.
:ivar os_type: The OS Type. Required. Known values are: "Linux" and "Windows".
:vartype os_type: str or ~azure.mgmt.workloads.models.OSType
@@ -1710,7 +1710,7 @@ class LinuxConfiguration(OSConfiguration):
Azure-Endorsed Distributions
`_.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar os_type: The OS Type. Required. Known values are: "Linux" and "Windows".
:vartype os_type: str or ~azure.mgmt.workloads.models.OSType
@@ -1924,7 +1924,7 @@ class Resource(_serialization.Model):
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}.
+ /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
@@ -1965,10 +1965,10 @@ class TrackedResource(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.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /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
@@ -2018,10 +2018,10 @@ class Monitor(TrackedResource): # pylint: disable=too-many-instance-attributes
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.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /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
@@ -2201,32 +2201,12 @@ class MonitorPropertiesErrors(Error):
:vartype inner_error: ~azure.mgmt.workloads.models.ErrorInnerError
"""
- _validation = {
- "code": {"readonly": True},
- "message": {"readonly": True},
- "target": {"readonly": True},
- "details": {"readonly": True},
- "inner_error": {"readonly": True},
- }
-
- _attribute_map = {
- "code": {"key": "code", "type": "str"},
- "message": {"key": "message", "type": "str"},
- "target": {"key": "target", "type": "str"},
- "details": {"key": "details", "type": "[Error]"},
- "inner_error": {"key": "innerError", "type": "ErrorInnerError"},
- }
-
- def __init__(self, **kwargs: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
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.
+ All required parameters must be populated in order to send to server.
:ivar configuration_type: The type of file share config. Required. Known values are: "Skip",
"CreateAndMount", and "Mount".
@@ -2267,7 +2247,7 @@ def __init__(
class MsSqlServerProviderInstanceProperties(ProviderSpecificProperties):
"""Gets or sets the SQL server provider properties.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar provider_type: The provider type. For example, the value can be SapHana. Required.
:vartype provider_type: str
@@ -2530,7 +2510,7 @@ class OperationsContent(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /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
@@ -2615,7 +2595,7 @@ def __init__(
class OperationsDefinition(_serialization.Model):
"""Properties of an Operation.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar name: Name of the operation. Required.
:vartype name: str
@@ -2683,7 +2663,7 @@ def __init__(
self.properties = properties
-class OperationsDefinitionArrayResponseWithContinuation(_serialization.Model):
+class OperationsDefinitionArrayResponseWithContinuation(_serialization.Model): # pylint: disable=name-too-long
"""Defines the workload operation definition response.
:ivar value: Defines the workload operation definition response properties.
@@ -2718,7 +2698,7 @@ def __init__(
class OperationsDisplayDefinition(_serialization.Model):
"""Defines the workload operation.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar provider: Defines the workload provider. Required.
:vartype provider: str
@@ -2765,7 +2745,7 @@ def __init__(self, *, provider: str, resource: str, operation: str, description:
class OperationsDefinitionDisplay(OperationsDisplayDefinition):
"""Display information of the operation.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar provider: Defines the workload provider. Required.
:vartype provider: str
@@ -2777,38 +2757,11 @@ class OperationsDefinitionDisplay(OperationsDisplayDefinition):
:vartype description: str
"""
- _validation = {
- "provider": {"required": True},
- "resource": {"required": True},
- "operation": {"required": True},
- "description": {"required": True},
- }
-
- _attribute_map = {
- "provider": {"key": "provider", "type": "str"},
- "resource": {"key": "resource", "type": "str"},
- "operation": {"key": "operation", "type": "str"},
- "description": {"key": "description", "type": "str"},
- }
-
- def __init__(self, *, provider: str, resource: str, operation: str, description: str, **kwargs: Any) -> None:
- """
- :keyword provider: Defines the workload provider. Required.
- :paramtype provider: str
- :keyword resource: Defines the workload resource. Required.
- :paramtype resource: str
- :keyword operation: Defines the workload operation. Required.
- :paramtype operation: str
- :keyword description: Describes the workload operation. Required.
- :paramtype description: str
- """
- super().__init__(provider=provider, resource=resource, operation=operation, description=description, **kwargs)
-
class OperationStatusResult(_serialization.Model):
"""The current status of an async operation.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified ID for the async operation.
:vartype id: str
@@ -2906,7 +2859,7 @@ class OSProfile(_serialization.Model):
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:`
`
+ 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
@@ -2951,7 +2904,7 @@ def __init__(
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:`
`
+ 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
@@ -3003,10 +2956,10 @@ def __init__(
self.sap_fqdn = sap_fqdn
-class PrometheusHaClusterProviderInstanceProperties(ProviderSpecificProperties):
+class PrometheusHaClusterProviderInstanceProperties(ProviderSpecificProperties): # pylint: disable=name-too-long
"""Gets or sets the PrometheusHaCluster provider properties.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar provider_type: The provider type. For example, the value can be SapHana. Required.
:vartype provider_type: str
@@ -3080,7 +3033,7 @@ def __init__(
class PrometheusOSProviderInstanceProperties(ProviderSpecificProperties):
"""Gets or sets the PrometheusOS provider properties.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar provider_type: The provider type. For example, the value can be SapHana. Required.
:vartype provider_type: str
@@ -3144,7 +3097,7 @@ class ProxyResource(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /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
@@ -3156,24 +3109,6 @@ class ProxyResource(Resource):
:vartype system_data: ~azure.mgmt.workloads.models.SystemData
"""
- _validation = {
- "id": {"readonly": True},
- "name": {"readonly": True},
- "type": {"readonly": True},
- "system_data": {"readonly": True},
- }
-
- _attribute_map = {
- "id": {"key": "id", "type": "str"},
- "name": {"key": "name", "type": "str"},
- "type": {"key": "type", "type": "str"},
- "system_data": {"key": "systemData", "type": "SystemData"},
- }
-
- def __init__(self, **kwargs: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
class ProviderInstance(ProxyResource):
"""A provider instance associated with SAP monitor.
@@ -3181,7 +3116,7 @@ class ProviderInstance(ProxyResource):
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}.
+ /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
@@ -3293,36 +3228,16 @@ class ProviderInstancePropertiesErrors(Error):
:vartype inner_error: ~azure.mgmt.workloads.models.ErrorInnerError
"""
- _validation = {
- "code": {"readonly": True},
- "message": {"readonly": True},
- "target": {"readonly": True},
- "details": {"readonly": True},
- "inner_error": {"readonly": True},
- }
-
- _attribute_map = {
- "code": {"key": "code", "type": "str"},
- "message": {"key": "message", "type": "str"},
- "target": {"key": "target", "type": "str"},
- "details": {"key": "details", "type": "[Error]"},
- "inner_error": {"key": "innerError", "type": "ErrorInnerError"},
- }
-
- def __init__(self, **kwargs: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
class SAPApplicationServerInstance(TrackedResource): # pylint: disable=too-many-instance-attributes
"""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.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /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
@@ -3480,7 +3395,7 @@ def __init__(
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.
+ 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
@@ -3613,10 +3528,10 @@ class SAPCentralServerInstance(TrackedResource): # pylint: disable=too-many-ins
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.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /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
@@ -3760,10 +3675,10 @@ class SAPDatabaseInstance(TrackedResource): # pylint: disable=too-many-instance
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /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
@@ -3924,7 +3839,7 @@ def __init__(
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.
+ 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
@@ -4026,11 +3941,11 @@ def __init__(
self.volume_configurations = volume_configurations
-class SAPInstallWithoutOSConfigSoftwareConfiguration(SoftwareConfiguration):
+class SAPInstallWithoutOSConfigSoftwareConfiguration(SoftwareConfiguration): # pylint: disable=name-too-long
"""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.
+ All required parameters must be populated in order to send to server.
:ivar software_installation_type: The SAP software installation Type. Required. Known values
are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External".
@@ -4099,7 +4014,7 @@ class SapLandscapeMonitor(ProxyResource):
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}.
+ /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
@@ -4304,7 +4219,7 @@ class SapNetWeaverProviderInstanceProperties(
): # pylint: disable=too-many-instance-attributes
"""Gets or sets the provider properties.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar provider_type: The provider type. For example, the value can be SapHana. Required.
:vartype provider_type: str
@@ -4411,7 +4326,7 @@ def __init__(
class SAPSizingRecommendationRequest(_serialization.Model):
"""The SAP Sizing Recommendation request.
- All required parameters must be populated in order to send to Azure.
+ 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
@@ -4515,7 +4430,7 @@ class SAPSizingRecommendationResult(_serialization.Model):
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.
+ All required parameters must be populated in order to send to server.
:ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known
values are: "SingleServer" and "ThreeTier".
@@ -4608,7 +4523,7 @@ def __init__(
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.
+ 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
@@ -4690,10 +4605,10 @@ class SAPVirtualInstance(TrackedResource): # pylint: disable=too-many-instance-
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /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
@@ -4882,7 +4797,7 @@ def __init__(
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.
+ All required parameters must be populated in order to send to server.
:ivar software_installation_type: The SAP software installation Type. Required. Known values
are: "ServiceInitiated", "SAPInstallWithoutOSConfig", and "External".
@@ -5006,7 +4921,7 @@ class SingleServerConfiguration(InfrastructureConfiguration):
infrastructure, please see `here
`_.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known
values are: "SingleServer" and "ThreeTier".
@@ -5097,7 +5012,7 @@ class SingleServerCustomResourceNames(_serialization.Model):
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.
+ All required parameters must be populated in order to send to server.
:ivar naming_pattern_type: The pattern type to be used for resource naming. Required.
"FullResourceName"
@@ -5124,7 +5039,7 @@ 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.
+ All required parameters must be populated in order to send to server.
:ivar naming_pattern_type: The pattern type to be used for resource naming. Required.
"FullResourceName"
@@ -5157,7 +5072,7 @@ def __init__(
class SingleServerRecommendationResult(SAPSizingRecommendationResult):
"""The recommended configuration for a single server SAP system.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known
values are: "SingleServer" and "ThreeTier".
@@ -5189,7 +5104,7 @@ 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.
+ All required parameters must be populated in order to send to server.
:ivar configuration_type: The type of file share config. Required. Known values are: "Skip",
"CreateAndMount", and "Mount".
@@ -5456,7 +5371,7 @@ class ThreeTierConfiguration(InfrastructureConfiguration):
infrastructure, please see `here
`_.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known
values are: "SingleServer" and "ThreeTier".
@@ -5552,7 +5467,7 @@ class ThreeTierCustomResourceNames(_serialization.Model):
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.
+ All required parameters must be populated in order to send to server.
:ivar naming_pattern_type: The pattern type to be used for resource naming. Required.
"FullResourceName"
@@ -5579,7 +5494,7 @@ 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.
+ All required parameters must be populated in order to send to server.
:ivar naming_pattern_type: The pattern type to be used for resource naming. Required.
"FullResourceName"
@@ -5643,7 +5558,7 @@ def __init__(
class ThreeTierRecommendationResult(SAPSizingRecommendationResult):
"""The recommended configuration for a three tier SAP system.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar deployment_type: The type of SAP deployment, single server or Three tier. Required. Known
values are: "SingleServer" and "ThreeTier".
@@ -5869,7 +5784,7 @@ class UserAssignedServiceIdentity(_serialization.Model):
"""A pre-created user assigned identity with appropriate roles assigned. To learn more on identity
and roles required, visit the ACSS how-to-guide.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar type: Type of manage identity. Required. Known values are: "None" and "UserAssigned".
:vartype type: str or ~azure.mgmt.workloads.models.ManagedServiceIdentityType
@@ -5908,7 +5823,7 @@ def __init__(
class VirtualMachineConfiguration(_serialization.Model):
"""Defines the virtual machine configuration.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar vm_size: The virtual machine size. Required.
:vartype vm_size: str
@@ -6033,7 +5948,7 @@ def __init__(
class WindowsConfiguration(OSConfiguration):
"""Specifies Windows operating system settings on the virtual machine.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar os_type: The OS Type. Required. Known values are: "Linux" and "Windows".
:vartype os_type: str or ~azure.mgmt.workloads.models.OSType
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py
index 03edd309890e..f49dd1d21b92 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_monitors_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
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.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+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
@@ -30,12 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import WorkloadsMgmtClientMixinABC, _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -47,7 +48,7 @@ def build_list_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: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -56,7 +57,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -71,7 +72,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -86,7 +87,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -101,7 +102,7 @@ def build_get_request(resource_group_name: str, monitor_name: str, subscription_
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -117,7 +118,7 @@ def build_get_request(resource_group_name: str, monitor_name: str, subscription_
"monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -134,7 +135,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -151,7 +152,7 @@ def build_create_request(
"monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -170,7 +171,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -186,7 +187,7 @@ def build_delete_request(
"monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -203,7 +204,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -220,7 +221,7 @@ def build_update_request(
"monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -259,7 +260,6 @@ def list(self, **kwargs: Any) -> Iterable["_models.Monitor"]:
Gets a list of SAP monitors in the specified subscription. The operations returns various
properties of each SAP monitor.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Monitor or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.Monitor]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -267,12 +267,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Monitor"]:
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MonitorListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -283,15 +281,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Monitor"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -303,13 +299,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MonitorListResult", pipeline_response)
@@ -319,10 +314,11 @@ def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -335,8 +331,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors"}
-
@distributed_trace
def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Monitor"]:
"""Gets a list of SAP monitors.
@@ -346,7 +340,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
: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 Monitor or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.Monitor]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -354,12 +347,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.MonitorListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -370,16 +361,14 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_resource_group_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -391,13 +380,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("MonitorListResult", pipeline_response)
@@ -407,10 +395,11 @@ def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -423,10 +412,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors"
- }
-
@distributed_trace
def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.Monitor:
"""Gets properties of a SAP monitor.
@@ -439,12 +424,11 @@ def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _mo
:type resource_group_name: str
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Monitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.Monitor
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -455,25 +439,22 @@ def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _mo
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Monitor] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
monitor_name=monitor_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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -483,21 +464,21 @@ def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _mo
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Monitor", pipeline_response)
+ deserialized = self._deserialize("Monitor", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"
- }
+ return deserialized # type: ignore
def _create_initial(
- self, resource_group_name: str, monitor_name: str, monitor_parameter: Union[_models.Monitor, IO], **kwargs: Any
- ) -> _models.Monitor:
- error_map = {
+ self,
+ resource_group_name: str,
+ monitor_name: str,
+ monitor_parameter: Union[_models.Monitor, IO[bytes]],
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -508,21 +489,19 @@ def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.Monitor] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(monitor_parameter, (IO, bytes)):
+ if isinstance(monitor_parameter, (IOBase, bytes)):
_content = monitor_parameter
else:
_json = self._serialize.body(monitor_parameter, "Monitor")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
subscription_id=self._config.subscription_id,
@@ -530,39 +509,35 @@ def _create_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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("Monitor", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Monitor", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"
- }
-
@overload
def begin_create(
self,
@@ -587,14 +562,6 @@ def begin_create(
: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 Monitor or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.Monitor]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -605,7 +572,7 @@ def begin_create(
self,
resource_group_name: str,
monitor_name: str,
- monitor_parameter: IO,
+ monitor_parameter: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -620,18 +587,10 @@ def begin_create(
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
:param monitor_parameter: Request body representing a SAP monitor. Required.
- :type monitor_parameter: IO
+ :type monitor_parameter: IO[bytes]
: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 Monitor or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.Monitor]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -639,7 +598,11 @@ def begin_create(
@distributed_trace
def begin_create(
- self, resource_group_name: str, monitor_name: str, monitor_parameter: Union[_models.Monitor, IO], **kwargs: Any
+ self,
+ resource_group_name: str,
+ monitor_name: str,
+ monitor_parameter: Union[_models.Monitor, IO[bytes]],
+ **kwargs: Any
) -> LROPoller[_models.Monitor]:
"""Creates a SAP monitor.
@@ -651,19 +614,8 @@ def begin_create(
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
:param monitor_parameter: Request body representing a SAP monitor. Is either a Monitor type or
- a IO type. Required.
- :type monitor_parameter: ~azure.mgmt.workloads.models.Monitor 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.
+ a IO[bytes] type. Required.
+ :type monitor_parameter: ~azure.mgmt.workloads.models.Monitor or IO[bytes]
:return: An instance of LROPoller that returns either Monitor or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.Monitor]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -671,9 +623,7 @@ def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.Monitor] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
@@ -691,12 +641,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Monitor", pipeline_response)
+ deserialized = self._deserialize("Monitor", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -708,22 +659,18 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Monitor].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/monitors/{monitorName}"
- }
+ return LROPoller[_models.Monitor](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- def _delete_initial(
- self, resource_group_name: str, monitor_name: str, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -734,46 +681,42 @@ def _delete_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
monitor_name=monitor_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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -788,14 +731,6 @@ def begin_delete(
:type resource_group_name: str
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -804,9 +739,7 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -821,12 +754,13 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -838,17 +772,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"
- }
+ return LROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@overload
def update(
@@ -875,7 +807,6 @@ def update(
: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: Monitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.Monitor
:raises ~azure.core.exceptions.HttpResponseError:
@@ -886,7 +817,7 @@ def update(
self,
resource_group_name: str,
monitor_name: str,
- body: IO,
+ body: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -902,11 +833,10 @@ def update(
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
:param body: The Update SAP workload monitor request body. Required.
- :type body: IO
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Monitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.Monitor
:raises ~azure.core.exceptions.HttpResponseError:
@@ -914,7 +844,11 @@ def update(
@distributed_trace
def update(
- self, resource_group_name: str, monitor_name: str, body: Union[_models.UpdateMonitorRequest, IO], **kwargs: Any
+ self,
+ resource_group_name: str,
+ monitor_name: str,
+ body: Union[_models.UpdateMonitorRequest, IO[bytes]],
+ **kwargs: Any
) -> _models.Monitor:
"""Patches the Tags field of a SAP monitor.
@@ -927,17 +861,13 @@ def update(
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
:param body: The Update SAP workload monitor request body. Is either a UpdateMonitorRequest
- type or a IO type. Required.
- :type body: ~azure.mgmt.workloads.models.UpdateMonitorRequest 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
+ type or a IO[bytes] type. Required.
+ :type body: ~azure.mgmt.workloads.models.UpdateMonitorRequest or IO[bytes]
:return: Monitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.Monitor
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -948,21 +878,19 @@ def update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.Monitor] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
_json = self._serialize.body(body, "UpdateMonitorRequest")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
subscription_id=self._config.subscription_id,
@@ -970,15 +898,14 @@ def update(
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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -988,13 +915,9 @@ def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Monitor", pipeline_response)
+ deserialized = self._deserialize("Monitor", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py
index b39f613962e8..d5b0997d8f05 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +7,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -20,20 +20,18 @@
)
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.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 .. import models as _models
from .._serialization import Serializer
-from .._vendor import WorkloadsMgmtClientMixinABC, _convert_request
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -83,7 +81,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Lists all the available API operations under this PR.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -91,12 +88,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -107,14 +102,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -126,13 +119,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationListResult", pipeline_response)
@@ -142,10 +134,11 @@ def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -157,5 +150,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Workloads/operations"}
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py
index b364237a7170..bcaa36419eee 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_provider_instances_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
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.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+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
@@ -30,12 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import WorkloadsMgmtClientMixinABC, _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -47,7 +48,7 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -63,7 +64,7 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription
"monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -80,7 +81,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +98,7 @@ def build_get_request(
"providerInstanceName": _SERIALIZER.url("provider_instance_name", provider_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -114,7 +115,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -132,7 +133,7 @@ def build_create_request(
"providerInstanceName": _SERIALIZER.url("provider_instance_name", provider_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -151,7 +152,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -168,7 +169,7 @@ def build_delete_request(
"providerInstanceName": _SERIALIZER.url("provider_instance_name", provider_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -210,7 +211,6 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> It
:type resource_group_name: str
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ProviderInstance or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.workloads.models.ProviderInstance]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -218,12 +218,10 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> It
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ProviderInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -234,17 +232,15 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> It
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
monitor_name=monitor_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -256,13 +252,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ProviderInstanceListResult", pipeline_response)
@@ -272,10 +267,11 @@ def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -288,10 +284,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances"
- }
-
@distributed_trace
def get(
self, resource_group_name: str, monitor_name: str, provider_instance_name: str, **kwargs: Any
@@ -308,12 +300,11 @@ def get(
:type monitor_name: str
:param provider_instance_name: Name of the provider instance. Required.
:type provider_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ProviderInstance or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.ProviderInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -324,26 +315,23 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ProviderInstance] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
provider_instance_name=provider_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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -353,26 +341,22 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ProviderInstance", pipeline_response)
+ deserialized = self._deserialize("ProviderInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"
- }
+ return deserialized # type: ignore
def _create_initial(
self,
resource_group_name: str,
monitor_name: str,
provider_instance_name: str,
- provider_instance_parameter: Union[_models.ProviderInstance, IO],
+ provider_instance_parameter: Union[_models.ProviderInstance, IO[bytes]],
**kwargs: Any
- ) -> _models.ProviderInstance:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -383,21 +367,19 @@ def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.ProviderInstance] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(provider_instance_parameter, (IO, bytes)):
+ if isinstance(provider_instance_parameter, (IOBase, bytes)):
_content = provider_instance_parameter
else:
_json = self._serialize.body(provider_instance_parameter, "ProviderInstance")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
provider_instance_name=provider_instance_name,
@@ -406,39 +388,35 @@ def _create_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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("ProviderInstance", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ProviderInstance", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"
- }
-
@overload
def begin_create(
self,
@@ -467,14 +445,6 @@ def begin_create(
: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 ProviderInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.ProviderInstance]
@@ -487,7 +457,7 @@ def begin_create(
resource_group_name: str,
monitor_name: str,
provider_instance_name: str,
- provider_instance_parameter: IO,
+ provider_instance_parameter: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -505,18 +475,10 @@ def begin_create(
:param provider_instance_name: Name of the provider instance. Required.
:type provider_instance_name: str
:param provider_instance_parameter: Request body representing a provider instance. Required.
- :type provider_instance_parameter: IO
+ :type provider_instance_parameter: IO[bytes]
: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 ProviderInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.ProviderInstance]
@@ -529,7 +491,7 @@ def begin_create(
resource_group_name: str,
monitor_name: str,
provider_instance_name: str,
- provider_instance_parameter: Union[_models.ProviderInstance, IO],
+ provider_instance_parameter: Union[_models.ProviderInstance, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ProviderInstance]:
"""Creates a provider instance.
@@ -545,19 +507,8 @@ def begin_create(
:param provider_instance_name: Name of the provider instance. Required.
:type provider_instance_name: str
:param provider_instance_parameter: Request body representing a provider instance. Is either a
- ProviderInstance type or a IO type. Required.
- :type provider_instance_parameter: ~azure.mgmt.workloads.models.ProviderInstance 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.
+ ProviderInstance type or a IO[bytes] type. Required.
+ :type provider_instance_parameter: ~azure.mgmt.workloads.models.ProviderInstance or IO[bytes]
:return: An instance of LROPoller that returns either ProviderInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.ProviderInstance]
@@ -566,9 +517,7 @@ def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.ProviderInstance] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
@@ -587,12 +536,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ProviderInstance", pipeline_response)
+ deserialized = self._deserialize("ProviderInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -604,22 +554,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.ProviderInstance].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/monitors/{monitorName}/providerInstances/{providerInstanceName}"
- }
+ return LROPoller[_models.ProviderInstance](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
def _delete_initial(
self, resource_group_name: str, monitor_name: str, provider_instance_name: str, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -630,47 +578,43 @@ def _delete_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
provider_instance_name=provider_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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -688,14 +632,6 @@ def begin_delete(
:type monitor_name: str
:param provider_instance_name: Name of the provider instance. Required.
:type provider_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -704,9 +640,7 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -722,12 +656,13 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -739,14 +674,12 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"
- }
+ return LROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py
index f363a73c9abd..668df89099f1 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_application_server_instances_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
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.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+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
@@ -30,12 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import WorkloadsMgmtClientMixinABC, _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -53,7 +54,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +71,7 @@ def build_get_request(
"applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -91,7 +92,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -109,7 +110,7 @@ def build_create_request(
"applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -132,7 +133,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -150,7 +151,7 @@ def build_update_request(
"applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -173,7 +174,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -190,7 +191,7 @@ def build_delete_request(
"applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -207,7 +208,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -223,7 +224,7 @@ def build_list_request(
"sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -244,7 +245,7 @@ def build_start_instance_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -261,7 +262,7 @@ def build_start_instance_request(
"applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -282,7 +283,7 @@ def build_stop_instance_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -300,7 +301,7 @@ def build_stop_instance_request(
"applicationInstanceName": _SERIALIZER.url("application_instance_name", application_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -348,12 +349,11 @@ def get(
: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.workloads.models.SAPApplicationServerInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -364,26 +364,23 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -393,26 +390,22 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response)
+ deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"
- }
+ return deserialized # type: ignore
def _create_initial(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[Union[_models.SAPApplicationServerInstance, IO]] = None,
+ body: Optional[Union[_models.SAPApplicationServerInstance, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPApplicationServerInstance:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -423,16 +416,14 @@ def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -440,7 +431,7 @@ def _create_initial(
else:
_json = None
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
application_instance_name=application_instance_name,
@@ -449,39 +440,35 @@ def _create_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
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,
@@ -510,14 +497,6 @@ def begin_create(
: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:
@@ -531,7 +510,7 @@ def begin_create(
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -549,18 +528,10 @@ def begin_create(
Required.
:type application_instance_name: str
:param body: The SAP Application Server Instance resource request body. Default value is None.
- :type body: IO
+ :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
- :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:
@@ -574,7 +545,7 @@ def begin_create(
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[Union[_models.SAPApplicationServerInstance, IO]] = None,
+ body: Optional[Union[_models.SAPApplicationServerInstance, IO[bytes]]] = None,
**kwargs: Any
) -> LROPoller[_models.SAPApplicationServerInstance]:
"""Puts the SAP Application Server Instance resource. :code:`
`:code:`
`This will be used by
@@ -590,19 +561,8 @@ def begin_create(
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.workloads.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.
+ SAPApplicationServerInstance type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.SAPApplicationServerInstance or IO[bytes]
:return: An instance of LROPoller that returns either SAPApplicationServerInstance or the
result of cls(response)
:rtype:
@@ -612,9 +572,7 @@ def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -633,12 +591,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response)
+ deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -650,27 +609,25 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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}"
- }
+ return LROPoller[_models.SAPApplicationServerInstance](
+ 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,
application_instance_name: str,
- body: Optional[Union[_models.UpdateSAPApplicationInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPApplicationInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPApplicationServerInstance:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -681,16 +638,14 @@ def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -698,7 +653,7 @@ def _update_initial(
else:
_json = None
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
application_instance_name=application_instance_name,
@@ -707,39 +662,35 @@ def _update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"
- }
-
@overload
def begin_update(
self,
@@ -767,14 +718,6 @@ def begin_update(
: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:
@@ -788,7 +731,7 @@ def begin_update(
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -805,18 +748,10 @@ def begin_update(
Required.
:type application_instance_name: str
:param body: The SAP Application Server Instance resource request body. Default value is None.
- :type body: IO
+ :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
- :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:
@@ -830,7 +765,7 @@ def begin_update(
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[Union[_models.UpdateSAPApplicationInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPApplicationInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
) -> LROPoller[_models.SAPApplicationServerInstance]:
"""Puts the SAP Application Server Instance resource.
@@ -845,19 +780,8 @@ def begin_update(
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.workloads.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
- :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.
+ UpdateSAPApplicationInstanceRequest type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.UpdateSAPApplicationInstanceRequest or IO[bytes]
:return: An instance of LROPoller that returns either SAPApplicationServerInstance or the
result of cls(response)
:rtype:
@@ -867,9 +791,7 @@ def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -888,12 +810,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response)
+ deserialized = self._deserialize("SAPApplicationServerInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -905,22 +828,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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}/applicationInstances/{applicationInstanceName}"
- }
+ return LROPoller[_models.SAPApplicationServerInstance](
+ 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, application_instance_name: str, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -931,47 +852,43 @@ def _delete_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -989,14 +906,6 @@ def begin_delete(
: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 OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1005,9 +914,7 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -1023,12 +930,13 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1040,17 +948,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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}"
- }
+ return LROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -1065,7 +971,6 @@ def list(
: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.workloads.models.SAPApplicationServerInstance]
@@ -1074,12 +979,10 @@ def list(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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 = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1090,17 +993,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1112,13 +1013,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SAPApplicationServerInstanceList", pipeline_response)
@@ -1128,10 +1028,11 @@ def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1144,14 +1045,10 @@ def get_next(next_link=None):
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, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1162,47 +1059,43 @@ def _start_instance_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_start_instance_request(
+ _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,
- template_url=self._start_instance_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _start_instance_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/start"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_start_instance(
@@ -1219,14 +1112,6 @@ def begin_start_instance(
: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 OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1235,9 +1120,7 @@ def begin_start_instance(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -1253,12 +1136,13 @@ def begin_start_instance(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1270,27 +1154,25 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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"
- }
+ return LROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
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,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1301,16 +1183,14 @@ def _stop_instance_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -1318,7 +1198,7 @@ def _stop_instance_initial(
else:
_json = None
- request = build_stop_instance_request(
+ _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,
@@ -1327,36 +1207,34 @@ def _stop_instance_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _stop_instance_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}/stop"
- }
+ return deserialized # type: ignore
@overload
def begin_stop_instance(
@@ -1385,14 +1263,6 @@ def begin_stop_instance(
: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.workloads.models.OperationStatusResult]
@@ -1405,7 +1275,7 @@ def begin_stop_instance(
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1422,18 +1292,10 @@ def begin_stop_instance(
Required.
:type application_instance_name: str
:param body: SAP Application server instance stop request body. Default value is None.
- :type body: IO
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1446,7 +1308,7 @@ def begin_stop_instance(
resource_group_name: str,
sap_virtual_instance_name: str,
application_instance_name: str,
- body: Optional[Union[_models.StopRequest, IO]] = None,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
) -> LROPoller[_models.OperationStatusResult]:
"""Stops the SAP Application Server Instance.
@@ -1461,19 +1323,8 @@ def begin_stop_instance(
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.workloads.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.
+ a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.StopRequest or IO[bytes]
:return: An instance of LROPoller that returns either OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1482,9 +1333,7 @@ def begin_stop_instance(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -1503,12 +1352,13 @@ def begin_stop_instance(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1520,14 +1370,12 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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"
- }
+ return LROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py
index b6049f33c4d0..cba30581d84d 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_central_instances_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
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.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+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
@@ -30,12 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import WorkloadsMgmtClientMixinABC, _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -53,7 +54,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +71,7 @@ def build_get_request(
"centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -91,7 +92,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -109,7 +110,7 @@ def build_create_request(
"centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -132,7 +133,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -150,7 +151,7 @@ def build_update_request(
"centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -173,7 +174,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -190,7 +191,7 @@ def build_delete_request(
"centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -207,7 +208,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -223,7 +224,7 @@ def build_list_request(
"sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -244,7 +245,7 @@ def build_start_instance_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -261,7 +262,7 @@ def build_start_instance_request(
"centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -282,7 +283,7 @@ def build_stop_instance_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -300,7 +301,7 @@ def build_stop_instance_request(
"centralInstanceName": _SERIALIZER.url("central_instance_name", central_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -347,12 +348,11 @@ def get(
: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.workloads.models.SAPCentralServerInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -363,26 +363,23 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -392,26 +389,22 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response)
+ deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"
- }
+ return deserialized # type: ignore
def _create_initial(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[Union[_models.SAPCentralServerInstance, IO]] = None,
+ body: Optional[Union[_models.SAPCentralServerInstance, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPCentralServerInstance:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -422,16 +415,14 @@ def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -439,7 +430,7 @@ def _create_initial(
else:
_json = None
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
central_instance_name=central_instance_name,
@@ -448,39 +439,35 @@ def _create_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
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,
@@ -509,14 +496,6 @@ def begin_create(
: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.workloads.models.SAPCentralServerInstance]
@@ -529,7 +508,7 @@ def begin_create(
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -547,18 +526,10 @@ def begin_create(
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
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either SAPCentralServerInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPCentralServerInstance]
@@ -571,7 +542,7 @@ def begin_create(
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[Union[_models.SAPCentralServerInstance, IO]] = None,
+ body: Optional[Union[_models.SAPCentralServerInstance, IO[bytes]]] = None,
**kwargs: Any
) -> LROPoller[_models.SAPCentralServerInstance]:
"""Creates the SAP Central Services Instance resource. :code:`
`:code:`
`This will be used
@@ -587,19 +558,8 @@ def begin_create(
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.workloads.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.
+ SAPCentralServerInstance type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.SAPCentralServerInstance or IO[bytes]
:return: An instance of LROPoller that returns either SAPCentralServerInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPCentralServerInstance]
@@ -608,9 +568,7 @@ def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -629,12 +587,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response)
+ deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -646,27 +605,25 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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}"
- }
+ return LROPoller[_models.SAPCentralServerInstance](
+ 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,
central_instance_name: str,
- body: Optional[Union[_models.UpdateSAPCentralInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPCentralInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPCentralServerInstance:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -677,16 +634,14 @@ def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -694,7 +649,7 @@ def _update_initial(
else:
_json = None
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
central_instance_name=central_instance_name,
@@ -703,39 +658,35 @@ def _update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"
- }
-
@overload
def begin_update(
self,
@@ -764,14 +715,6 @@ def begin_update(
: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.workloads.models.SAPCentralServerInstance]
@@ -784,7 +727,7 @@ def begin_update(
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -802,18 +745,10 @@ def begin_update(
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
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either SAPCentralServerInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPCentralServerInstance]
@@ -826,7 +761,7 @@ def begin_update(
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[Union[_models.UpdateSAPCentralInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPCentralInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
) -> LROPoller[_models.SAPCentralServerInstance]:
"""Updates the SAP Central Services Instance resource. :code:`
`:code:`
`This can be used to
@@ -842,19 +777,8 @@ def begin_update(
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.workloads.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
- :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.
+ UpdateSAPCentralInstanceRequest type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.UpdateSAPCentralInstanceRequest or IO[bytes]
:return: An instance of LROPoller that returns either SAPCentralServerInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPCentralServerInstance]
@@ -863,9 +787,7 @@ def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -884,12 +806,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response)
+ deserialized = self._deserialize("SAPCentralServerInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -901,22 +824,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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}/centralInstances/{centralInstanceName}"
- }
+ return LROPoller[_models.SAPCentralServerInstance](
+ 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, central_instance_name: str, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -927,47 +848,43 @@ def _delete_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -987,14 +904,6 @@ def begin_delete(
: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 OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1003,9 +912,7 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -1021,12 +928,13 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1038,17 +946,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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}"
- }
+ return LROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -1063,7 +969,6 @@ def list(
: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.workloads.models.SAPCentralServerInstance]
@@ -1072,12 +977,10 @@ def list(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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 = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1088,17 +991,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1110,13 +1011,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SAPCentralInstanceList", pipeline_response)
@@ -1126,10 +1026,11 @@ def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1142,14 +1043,10 @@ def get_next(next_link=None):
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, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1160,47 +1057,43 @@ def _start_instance_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_start_instance_request(
+ _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,
- template_url=self._start_instance_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _start_instance_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/start"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_start_instance(
@@ -1217,14 +1110,6 @@ def begin_start_instance(
: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 OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1233,9 +1118,7 @@ def begin_start_instance(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -1251,12 +1134,13 @@ def begin_start_instance(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1268,27 +1152,25 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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"
- }
+ return LROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
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,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1299,16 +1181,14 @@ def _stop_instance_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -1316,7 +1196,7 @@ def _stop_instance_initial(
else:
_json = None
- request = build_stop_instance_request(
+ _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,
@@ -1325,36 +1205,34 @@ def _stop_instance_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _stop_instance_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}/stop"
- }
+ return deserialized # type: ignore
@overload
def begin_stop_instance(
@@ -1383,14 +1261,6 @@ def begin_stop_instance(
: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.workloads.models.OperationStatusResult]
@@ -1403,7 +1273,7 @@ def begin_stop_instance(
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1420,18 +1290,10 @@ def begin_stop_instance(
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
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1444,7 +1306,7 @@ def begin_stop_instance(
resource_group_name: str,
sap_virtual_instance_name: str,
central_instance_name: str,
- body: Optional[Union[_models.StopRequest, IO]] = None,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
) -> LROPoller[_models.OperationStatusResult]:
"""Stops the SAP Central Services Instance.
@@ -1459,19 +1321,8 @@ def begin_stop_instance(
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.workloads.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.
+ IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.StopRequest or IO[bytes]
:return: An instance of LROPoller that returns either OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1480,9 +1331,7 @@ def begin_stop_instance(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -1501,12 +1350,13 @@ def begin_stop_instance(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1518,14 +1368,12 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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"
- }
+ return LROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py
index 8c43d53b8451..1d516cd5f955 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_database_instances_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
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.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+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
@@ -30,12 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import WorkloadsMgmtClientMixinABC, _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -53,7 +54,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +71,7 @@ def build_get_request(
"databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -91,7 +92,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -109,7 +110,7 @@ def build_create_request(
"databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -132,7 +133,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -150,7 +151,7 @@ def build_update_request(
"databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -173,7 +174,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -190,7 +191,7 @@ def build_delete_request(
"databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -207,7 +208,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -223,7 +224,7 @@ def build_list_request(
"sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -244,7 +245,7 @@ def build_start_instance_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -261,7 +262,7 @@ def build_start_instance_request(
"databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -282,7 +283,7 @@ def build_stop_instance_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -300,7 +301,7 @@ def build_stop_instance_request(
"databaseInstanceName": _SERIALIZER.url("database_instance_name", database_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -347,12 +348,11 @@ def get(
: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.workloads.models.SAPDatabaseInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -363,26 +363,23 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -392,26 +389,22 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response)
+ deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"
- }
+ return deserialized # type: ignore
def _create_initial(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[Union[_models.SAPDatabaseInstance, IO]] = None,
+ body: Optional[Union[_models.SAPDatabaseInstance, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPDatabaseInstance:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -422,16 +415,14 @@ def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -439,7 +430,7 @@ def _create_initial(
else:
_json = None
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
database_instance_name=database_instance_name,
@@ -448,39 +439,35 @@ def _create_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
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,
@@ -510,14 +497,6 @@ def begin_create(
: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.workloads.models.SAPDatabaseInstance]
@@ -530,7 +509,7 @@ def begin_create(
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -549,18 +528,10 @@ def begin_create(
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
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either SAPDatabaseInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance]
@@ -573,7 +544,7 @@ def begin_create(
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[Union[_models.SAPDatabaseInstance, IO]] = None,
+ body: Optional[Union[_models.SAPDatabaseInstance, IO[bytes]]] = None,
**kwargs: Any
) -> LROPoller[_models.SAPDatabaseInstance]:
"""Creates the Database resource corresponding to the Virtual Instance for SAP solutions resource.
@@ -590,19 +561,8 @@ def begin_create(
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.workloads.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.
+ type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.SAPDatabaseInstance or IO[bytes]
:return: An instance of LROPoller that returns either SAPDatabaseInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance]
@@ -611,9 +571,7 @@ def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -632,12 +590,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response)
+ deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -649,27 +608,25 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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}"
- }
+ return LROPoller[_models.SAPDatabaseInstance](
+ 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,
database_instance_name: str,
- body: Optional[Union[_models.UpdateSAPDatabaseInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPDatabaseInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPDatabaseInstance:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -680,16 +637,14 @@ def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -697,7 +652,7 @@ def _update_initial(
else:
_json = None
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
database_instance_name=database_instance_name,
@@ -706,39 +661,35 @@ def _update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"
- }
-
@overload
def begin_update(
self,
@@ -766,14 +717,6 @@ def begin_update(
: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.workloads.models.SAPDatabaseInstance]
@@ -786,7 +729,7 @@ def begin_update(
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -803,18 +746,10 @@ def begin_update(
generation to work correctly. Required.
:type database_instance_name: str
:param body: Database resource update request body. Default value is None.
- :type body: IO
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either SAPDatabaseInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance]
@@ -827,7 +762,7 @@ def begin_update(
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[Union[_models.UpdateSAPDatabaseInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPDatabaseInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
) -> LROPoller[_models.SAPDatabaseInstance]:
"""Updates the Database resource.
@@ -842,19 +777,8 @@ def begin_update(
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.workloads.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
- :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.
+ UpdateSAPDatabaseInstanceRequest type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.UpdateSAPDatabaseInstanceRequest or IO[bytes]
:return: An instance of LROPoller that returns either SAPDatabaseInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPDatabaseInstance]
@@ -863,9 +787,7 @@ def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -884,12 +806,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response)
+ deserialized = self._deserialize("SAPDatabaseInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -901,22 +824,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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}/databaseInstances/{databaseInstanceName}"
- }
+ return LROPoller[_models.SAPDatabaseInstance](
+ 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, database_instance_name: str, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -927,47 +848,43 @@ def _delete_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -986,14 +903,6 @@ def begin_delete(
: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 OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1002,9 +911,7 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -1020,12 +927,13 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1037,17 +945,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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}"
- }
+ return LROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -1061,7 +967,6 @@ def list(
: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.workloads.models.SAPDatabaseInstance]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1069,12 +974,10 @@ def list(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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 = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1085,17 +988,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1107,13 +1008,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SAPDatabaseInstanceList", pipeline_response)
@@ -1123,10 +1023,11 @@ def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1139,14 +1040,10 @@ def get_next(next_link=None):
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, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1157,47 +1054,43 @@ def _start_instance_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_start_instance_request(
+ _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,
- template_url=self._start_instance_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _start_instance_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/start"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_start_instance(
@@ -1214,14 +1107,6 @@ def begin_start_instance(
: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 OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1230,9 +1115,7 @@ def begin_start_instance(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -1248,12 +1131,13 @@ def begin_start_instance(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1265,27 +1149,25 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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"
- }
+ return LROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
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,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1296,16 +1178,14 @@ def _stop_instance_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -1313,7 +1193,7 @@ def _stop_instance_initial(
else:
_json = None
- request = build_stop_instance_request(
+ _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,
@@ -1322,36 +1202,34 @@ def _stop_instance_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _stop_instance_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}/stop"
- }
+ return deserialized # type: ignore
@overload
def begin_stop_instance(
@@ -1380,14 +1258,6 @@ def begin_stop_instance(
: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.workloads.models.OperationStatusResult]
@@ -1400,7 +1270,7 @@ def begin_stop_instance(
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1417,18 +1287,10 @@ def begin_stop_instance(
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
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1441,7 +1303,7 @@ def begin_stop_instance(
resource_group_name: str,
sap_virtual_instance_name: str,
database_instance_name: str,
- body: Optional[Union[_models.StopRequest, IO]] = None,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
) -> LROPoller[_models.OperationStatusResult]:
"""Stops the database instance of the SAP system.
@@ -1456,19 +1318,8 @@ def begin_stop_instance(
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.workloads.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.
+ type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.StopRequest or IO[bytes]
:return: An instance of LROPoller that returns either OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1477,9 +1328,7 @@ def begin_stop_instance(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -1498,12 +1347,13 @@ def begin_stop_instance(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1515,14 +1365,12 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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"
- }
+ return LROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_landscape_monitor_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_landscape_monitor_operations.py
index 87f734365aff..6d886923ca7c 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_landscape_monitor_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_landscape_monitor_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,20 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+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 .. import models as _models
from .._serialization import Serializer
-from .._vendor import WorkloadsMgmtClientMixinABC, _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +42,7 @@ def build_get_request(resource_group_name: str, monitor_name: str, subscription_
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -59,7 +58,7 @@ def build_get_request(resource_group_name: str, monitor_name: str, subscription_
"monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -76,7 +75,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -93,7 +92,7 @@ def build_create_request(
"monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -112,7 +111,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -128,7 +127,7 @@ def build_delete_request(
"monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -145,7 +144,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -162,7 +161,7 @@ def build_update_request(
"monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -179,7 +178,7 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -195,7 +194,7 @@ def build_list_request(resource_group_name: str, monitor_name: str, subscription
"monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -237,12 +236,11 @@ def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _mo
:type resource_group_name: str
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -253,25 +251,22 @@ def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _mo
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SapLandscapeMonitor] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
monitor_name=monitor_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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -281,16 +276,12 @@ def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _mo
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response)
+ deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default"
- }
+ return deserialized # type: ignore
@overload
def create(
@@ -318,7 +309,6 @@ def create(
: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: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
@@ -329,7 +319,7 @@ def create(
self,
resource_group_name: str,
monitor_name: str,
- sap_landscape_monitor_parameter: IO,
+ sap_landscape_monitor_parameter: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -346,11 +336,10 @@ def create(
:type monitor_name: str
:param sap_landscape_monitor_parameter: Request body representing a configuration for Sap
Landscape Monitor Dashboard. Required.
- :type sap_landscape_monitor_parameter: IO
+ :type sap_landscape_monitor_parameter: IO[bytes]
: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: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
@@ -361,7 +350,7 @@ def create(
self,
resource_group_name: str,
monitor_name: str,
- sap_landscape_monitor_parameter: Union[_models.SapLandscapeMonitor, IO],
+ sap_landscape_monitor_parameter: Union[_models.SapLandscapeMonitor, IO[bytes]],
**kwargs: Any
) -> _models.SapLandscapeMonitor:
"""Creates a SAP Landscape Monitor Dashboard.
@@ -375,17 +364,15 @@ def create(
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
:param sap_landscape_monitor_parameter: Request body representing a configuration for Sap
- Landscape Monitor Dashboard. Is either a SapLandscapeMonitor type or a IO type. Required.
- :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor 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
+ Landscape Monitor Dashboard. Is either a SapLandscapeMonitor type or a IO[bytes] type.
+ Required.
+ :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor or
+ IO[bytes]
:return: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -396,21 +383,19 @@ def create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.SapLandscapeMonitor] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(sap_landscape_monitor_parameter, (IO, bytes)):
+ if isinstance(sap_landscape_monitor_parameter, (IOBase, bytes)):
_content = sap_landscape_monitor_parameter
else:
_json = self._serialize.body(sap_landscape_monitor_parameter, "SapLandscapeMonitor")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
subscription_id=self._config.subscription_id,
@@ -418,15 +403,14 @@ def create(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -436,21 +420,13 @@ def create(
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("SapLandscapeMonitor", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response)
+ deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default"
- }
-
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, monitor_name: str, **kwargs: Any
@@ -465,12 +441,11 @@ def delete( # pylint: disable=inconsistent-return-statements
:type resource_group_name: str
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -481,25 +456,22 @@ def delete( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -510,11 +482,7 @@ def delete( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
def update(
@@ -542,7 +510,6 @@ def update(
: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: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
@@ -553,7 +520,7 @@ def update(
self,
resource_group_name: str,
monitor_name: str,
- sap_landscape_monitor_parameter: IO,
+ sap_landscape_monitor_parameter: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -570,11 +537,10 @@ def update(
:type monitor_name: str
:param sap_landscape_monitor_parameter: Request body representing a configuration for Sap
Landscape Monitor Dashboard. Required.
- :type sap_landscape_monitor_parameter: IO
+ :type sap_landscape_monitor_parameter: IO[bytes]
: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: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
@@ -585,7 +551,7 @@ def update(
self,
resource_group_name: str,
monitor_name: str,
- sap_landscape_monitor_parameter: Union[_models.SapLandscapeMonitor, IO],
+ sap_landscape_monitor_parameter: Union[_models.SapLandscapeMonitor, IO[bytes]],
**kwargs: Any
) -> _models.SapLandscapeMonitor:
"""Patches the SAP Landscape Monitor Dashboard.
@@ -599,17 +565,15 @@ def update(
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
:param sap_landscape_monitor_parameter: Request body representing a configuration for Sap
- Landscape Monitor Dashboard. Is either a SapLandscapeMonitor type or a IO type. Required.
- :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor 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
+ Landscape Monitor Dashboard. Is either a SapLandscapeMonitor type or a IO[bytes] type.
+ Required.
+ :type sap_landscape_monitor_parameter: ~azure.mgmt.workloads.models.SapLandscapeMonitor or
+ IO[bytes]
:return: SapLandscapeMonitor or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitor
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -620,21 +584,19 @@ def update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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.SapLandscapeMonitor] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(sap_landscape_monitor_parameter, (IO, bytes)):
+ if isinstance(sap_landscape_monitor_parameter, (IOBase, bytes)):
_content = sap_landscape_monitor_parameter
else:
_json = self._serialize.body(sap_landscape_monitor_parameter, "SapLandscapeMonitor")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
monitor_name=monitor_name,
subscription_id=self._config.subscription_id,
@@ -642,15 +604,14 @@ def update(
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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -660,16 +621,12 @@ def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response)
+ deserialized = self._deserialize("SapLandscapeMonitor", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.SapLandscapeMonitorListResult:
@@ -683,12 +640,11 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m
:type resource_group_name: str
:param monitor_name: Name of the SAP monitor resource. Required.
:type monitor_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SapLandscapeMonitorListResult or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SapLandscapeMonitorListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -699,25 +655,22 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SapLandscapeMonitorListResult] = kwargs.pop("cls", None)
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
monitor_name=monitor_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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -727,13 +680,9 @@ def list(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _m
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SapLandscapeMonitorListResult", pipeline_response)
+ deserialized = self._deserialize("SapLandscapeMonitorListResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor"
- }
+ return deserialized # type: ignore
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py
index ea95ab55b2e0..7d5cb13d398d 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_sap_virtual_instances_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
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.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+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
@@ -30,12 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import WorkloadsMgmtClientMixinABC, _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -49,7 +50,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -66,7 +67,7 @@ def build_create_request(
"sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -85,7 +86,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -101,7 +102,7 @@ def build_get_request(
"sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -118,7 +119,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -135,7 +136,7 @@ def build_update_request(
"sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -154,7 +155,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -170,7 +171,7 @@ def build_delete_request(
"sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -185,7 +186,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -200,7 +201,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -215,7 +216,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -226,7 +227,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -243,7 +244,7 @@ def build_start_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -259,7 +260,7 @@ def build_start_request(
"sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -276,7 +277,7 @@ def build_stop_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -293,7 +294,7 @@ def build_stop_request(
"sapVirtualInstanceName": _SERIALIZER.url("sap_virtual_instance_name", sap_virtual_instance_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -329,10 +330,10 @@ def _create_initial(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[Union[_models.SAPVirtualInstance, IO]] = None,
+ body: Optional[Union[_models.SAPVirtualInstance, IO[bytes]]] = None,
**kwargs: Any
- ) -> _models.SAPVirtualInstance:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -343,16 +344,14 @@ def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -360,7 +359,7 @@ def _create_initial(
else:
_json = None
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
subscription_id=self._config.subscription_id,
@@ -368,39 +367,35 @@ def _create_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = 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)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
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,
@@ -424,14 +419,6 @@ def begin_create(
: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.workloads.models.SAPVirtualInstance]
@@ -443,7 +430,7 @@ def begin_create(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -457,18 +444,10 @@ def begin_create(
Required.
:type sap_virtual_instance_name: str
:param body: Virtual Instance for SAP solutions resource request body. Default value is None.
- :type body: IO
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either SAPVirtualInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPVirtualInstance]
@@ -480,7 +459,7 @@ def begin_create(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[Union[_models.SAPVirtualInstance, IO]] = None,
+ body: Optional[Union[_models.SAPVirtualInstance, IO[bytes]]] = None,
**kwargs: Any
) -> LROPoller[_models.SAPVirtualInstance]:
"""Creates a Virtual Instance for SAP solutions (VIS) resource.
@@ -492,19 +471,8 @@ def begin_create(
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.workloads.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.
+ SAPVirtualInstance type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.SAPVirtualInstance or IO[bytes]
:return: An instance of LROPoller that returns either SAPVirtualInstance or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.SAPVirtualInstance]
@@ -513,9 +481,7 @@ def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -533,12 +499,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SAPVirtualInstance", pipeline_response)
+ deserialized = self._deserialize("SAPVirtualInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -550,17 +517,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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}"
- }
+ return LROPoller[_models.SAPVirtualInstance](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def get(
@@ -574,12 +539,11 @@ def get(
: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.workloads.models.SAPVirtualInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -590,25 +554,22 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -618,16 +579,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPVirtualInstance", pipeline_response)
+ deserialized = self._deserialize("SAPVirtualInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"
- }
+ return deserialized # type: ignore
@overload
def update(
@@ -653,7 +610,6 @@ def update(
: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: SAPVirtualInstance or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -664,7 +620,7 @@ def update(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -679,11 +635,10 @@ def update(
: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
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SAPVirtualInstance or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -694,7 +649,7 @@ def update(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[Union[_models.UpdateSAPVirtualInstanceRequest, IO]] = None,
+ body: Optional[Union[_models.UpdateSAPVirtualInstanceRequest, IO[bytes]]] = None,
**kwargs: Any
) -> _models.SAPVirtualInstance:
"""Updates a Virtual Instance for SAP solutions resource.
@@ -706,17 +661,13 @@ def update(
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.workloads.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
+ UpdateSAPVirtualInstanceRequest type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.UpdateSAPVirtualInstanceRequest or IO[bytes]
:return: SAPVirtualInstance or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPVirtualInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -727,16 +678,14 @@ def update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -744,7 +693,7 @@ def update(
else:
_json = None
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
subscription_id=self._config.subscription_id,
@@ -752,15 +701,14 @@ def update(
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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -770,21 +718,17 @@ def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPVirtualInstance", pipeline_response)
+ deserialized = self._deserialize("SAPVirtualInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"
- }
+ return deserialized # type: ignore
def _delete_initial(
self, resource_group_name: str, sap_virtual_instance_name: str, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -795,46 +739,42 @@ def _delete_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -849,14 +789,6 @@ def begin_delete(
: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 OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -865,9 +797,7 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -882,12 +812,13 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -899,17 +830,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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}"
- }
+ return LROPoller[_models.OperationStatusResult](
+ 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"]:
@@ -918,7 +847,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
: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.workloads.models.SAPVirtualInstance]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -926,12 +854,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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 = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -942,16 +868,14 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_resource_group_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -963,13 +887,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SAPVirtualInstanceList", pipeline_response)
@@ -979,10 +902,11 @@ def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -995,15 +919,10 @@ def get_next(next_link=None):
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.workloads.models.SAPVirtualInstance]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1011,12 +930,10 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SAPVirtualIns
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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 = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1027,15 +944,13 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SAPVirtualIns
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_subscription_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1047,13 +962,12 @@ 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
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SAPVirtualInstanceList", pipeline_response)
@@ -1063,10 +977,11 @@ def extract_data(pipeline_response):
return deserialized.next_link 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=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1079,14 +994,10 @@ def get_next(next_link=None):
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, **kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1097,46 +1008,42 @@ def _start_initial(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
- cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_start_request(
+ _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,
- template_url=self._start_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _start_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_start(
@@ -1151,14 +1058,6 @@ def begin_start(
: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 OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1167,9 +1066,7 @@ def begin_start(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
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)
@@ -1184,12 +1081,13 @@ def begin_start(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1201,26 +1099,24 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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"
- }
+ 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, IO]] = None,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
- ) -> Optional[_models.OperationStatusResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1231,16 +1127,14 @@ def _stop_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(body, (IO, bytes)):
+ if isinstance(body, (IOBase, bytes)):
_content = body
else:
if body is not None:
@@ -1248,7 +1142,7 @@ def _stop_initial(
else:
_json = None
- request = build_stop_request(
+ _request = build_stop_request(
resource_group_name=resource_group_name,
sap_virtual_instance_name=sap_virtual_instance_name,
subscription_id=self._config.subscription_id,
@@ -1256,36 +1150,34 @@ def _stop_initial(
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)
+ _request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _stop_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop"
- }
+ return deserialized # type: ignore
@overload
def begin_stop(
@@ -1312,14 +1204,6 @@ def begin_stop(
: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.workloads.models.OperationStatusResult]
@@ -1331,7 +1215,7 @@ def begin_stop(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[IO] = None,
+ body: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1347,18 +1231,10 @@ def begin_stop(
: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
+ :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
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1370,7 +1246,7 @@ def begin_stop(
self,
resource_group_name: str,
sap_virtual_instance_name: str,
- body: Optional[Union[_models.StopRequest, IO]] = None,
+ body: Optional[Union[_models.StopRequest, IO[bytes]]] = None,
**kwargs: Any
) -> LROPoller[_models.OperationStatusResult]:
"""Stops the SAP Application, that is the Application server instances and Central Services
@@ -1383,19 +1259,8 @@ def begin_stop(
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.workloads.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.
+ StopRequest type or a IO[bytes] type. Default value is None.
+ :type body: ~azure.mgmt.workloads.models.StopRequest or IO[bytes]
:return: An instance of LROPoller that returns either OperationStatusResult or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.workloads.models.OperationStatusResult]
@@ -1404,9 +1269,7 @@ def begin_stop(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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)
@@ -1424,12 +1287,13 @@ def begin_stop(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1441,14 +1305,12 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_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(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"
- }
+ return LROPoller[_models.OperationStatusResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_mgmt_client_operations.py b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_mgmt_client_operations.py
index 56e7992f9716..26dc2344b80d 100644
--- a/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_mgmt_client_operations.py
+++ b/sdk/workloads/azure-mgmt-workloads/azure/mgmt/workloads/operations/_workloads_mgmt_client_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
+from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -18,20 +19,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+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 .. import models as _models
from .._serialization import Serializer
-from .._vendor import WorkloadsMgmtClientMixinABC, _convert_request, _format_url_section
+from .._vendor import WorkloadsMgmtClientMixinABC
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +43,7 @@ def build_sap_sizing_recommendations_request(location: str, subscription_id: str
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -57,7 +57,7 @@ def build_sap_sizing_recommendations_request(location: str, subscription_id: str
"location": _SERIALIZER.url("location", location, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -74,7 +74,7 @@ def build_sap_supported_sku_request(location: str, subscription_id: str, **kwarg
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -88,7 +88,7 @@ def build_sap_supported_sku_request(location: str, subscription_id: str, **kwarg
"location": _SERIALIZER.url("location", location, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -105,7 +105,7 @@ def build_sap_disk_configurations_request(location: str, subscription_id: str, *
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -119,7 +119,7 @@ def build_sap_disk_configurations_request(location: str, subscription_id: str, *
"location": _SERIALIZER.url("location", location, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -132,11 +132,13 @@ def build_sap_disk_configurations_request(location: str, subscription_id: 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:
+def build_sap_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 {})
- api_version: Literal["2023-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -150,7 +152,7 @@ def build_sap_availability_zone_details_request(location: str, subscription_id:
"location": _SERIALIZER.url("location", location, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -164,6 +166,7 @@ def build_sap_availability_zone_details_request(location: str, subscription_id:
class WorkloadsMgmtClientOperationsMixin(WorkloadsMgmtClientMixinABC):
+
@overload
def sap_sizing_recommendations(
self,
@@ -184,7 +187,6 @@ def sap_sizing_recommendations(
: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.workloads.models.SAPSizingRecommendationResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -194,7 +196,7 @@ def sap_sizing_recommendations(
def sap_sizing_recommendations(
self,
location: str,
- sap_sizing_recommendation: Optional[IO] = None,
+ sap_sizing_recommendation: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -206,11 +208,10 @@ def sap_sizing_recommendations(
:type location: str
:param sap_sizing_recommendation: SAP Sizing Recommendation Request body. Default value is
None.
- :type sap_sizing_recommendation: IO
+ :type sap_sizing_recommendation: IO[bytes]
: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.workloads.models.SAPSizingRecommendationResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -220,7 +221,7 @@ def sap_sizing_recommendations(
def sap_sizing_recommendations(
self,
location: str,
- sap_sizing_recommendation: Optional[Union[_models.SAPSizingRecommendationRequest, IO]] = None,
+ sap_sizing_recommendation: Optional[Union[_models.SAPSizingRecommendationRequest, IO[bytes]]] = None,
**kwargs: Any
) -> _models.SAPSizingRecommendationResult:
"""Get SAP sizing recommendations by providing input SAPS for application tier and memory required
@@ -229,18 +230,14 @@ def sap_sizing_recommendations(
: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.
+ SAPSizingRecommendationRequest type or a IO[bytes] type. Default value is None.
:type sap_sizing_recommendation: ~azure.mgmt.workloads.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
+ IO[bytes]
:return: SAPSizingRecommendationResult or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPSizingRecommendationResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -251,16 +248,14 @@ def sap_sizing_recommendations(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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, (IO, bytes)):
+ if isinstance(sap_sizing_recommendation, (IOBase, bytes)):
_content = sap_sizing_recommendation
else:
if sap_sizing_recommendation is not None:
@@ -268,22 +263,21 @@ def sap_sizing_recommendations(
else:
_json = None
- request = build_sap_sizing_recommendations_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -293,16 +287,12 @@ def sap_sizing_recommendations(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPSizingRecommendationResult", pipeline_response)
+ deserialized = self._deserialize("SAPSizingRecommendationResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- sap_sizing_recommendations.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations"
- }
+ return deserialized # type: ignore
@overload
def sap_supported_sku(
@@ -322,7 +312,6 @@ def sap_supported_sku(
: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.workloads.models.SAPSupportedResourceSkusResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -332,7 +321,7 @@ def sap_supported_sku(
def sap_supported_sku(
self,
location: str,
- sap_supported_sku: Optional[IO] = None,
+ sap_supported_sku: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -342,11 +331,10 @@ def sap_supported_sku(
: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
+ :type sap_supported_sku: IO[bytes]
: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.workloads.models.SAPSupportedResourceSkusResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -356,7 +344,7 @@ def sap_supported_sku(
def sap_supported_sku(
self,
location: str,
- sap_supported_sku: Optional[Union[_models.SAPSupportedSkusRequest, IO]] = None,
+ sap_supported_sku: Optional[Union[_models.SAPSupportedSkusRequest, IO[bytes]]] = None,
**kwargs: Any
) -> _models.SAPSupportedResourceSkusResult:
"""Get a list of SAP supported SKUs for ASCS, Application and Database tier.
@@ -364,17 +352,13 @@ def sap_supported_sku(
: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.workloads.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
+ type or a IO[bytes] type. Default value is None.
+ :type sap_supported_sku: ~azure.mgmt.workloads.models.SAPSupportedSkusRequest or IO[bytes]
:return: SAPSupportedResourceSkusResult or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPSupportedResourceSkusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -385,16 +369,14 @@ def sap_supported_sku(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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, (IO, bytes)):
+ if isinstance(sap_supported_sku, (IOBase, bytes)):
_content = sap_supported_sku
else:
if sap_supported_sku is not None:
@@ -402,22 +384,21 @@ def sap_supported_sku(
else:
_json = None
- request = build_sap_supported_sku_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -427,16 +408,12 @@ def sap_supported_sku(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPSupportedResourceSkusResult", pipeline_response)
+ deserialized = self._deserialize("SAPSupportedResourceSkusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- sap_supported_sku.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku"
- }
+ return deserialized # type: ignore
@overload
def sap_disk_configurations(
@@ -456,7 +433,6 @@ def sap_disk_configurations(
: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.workloads.models.SAPDiskConfigurationsResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -466,7 +442,7 @@ def sap_disk_configurations(
def sap_disk_configurations(
self,
location: str,
- sap_disk_configurations: Optional[IO] = None,
+ sap_disk_configurations: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -476,11 +452,10 @@ def sap_disk_configurations(
: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
+ :type sap_disk_configurations: IO[bytes]
: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.workloads.models.SAPDiskConfigurationsResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -490,7 +465,7 @@ def sap_disk_configurations(
def sap_disk_configurations(
self,
location: str,
- sap_disk_configurations: Optional[Union[_models.SAPDiskConfigurationsRequest, IO]] = None,
+ sap_disk_configurations: Optional[Union[_models.SAPDiskConfigurationsRequest, IO[bytes]]] = None,
**kwargs: Any
) -> _models.SAPDiskConfigurationsResult:
"""Get the SAP Disk Configuration Layout prod/non-prod SAP System.
@@ -498,17 +473,14 @@ def sap_disk_configurations(
: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.workloads.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
+ SAPDiskConfigurationsRequest type or a IO[bytes] type. Default value is None.
+ :type sap_disk_configurations: ~azure.mgmt.workloads.models.SAPDiskConfigurationsRequest or
+ IO[bytes]
:return: SAPDiskConfigurationsResult or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPDiskConfigurationsResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -519,16 +491,14 @@ def sap_disk_configurations(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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, (IO, bytes)):
+ if isinstance(sap_disk_configurations, (IOBase, bytes)):
_content = sap_disk_configurations
else:
if sap_disk_configurations is not None:
@@ -536,22 +506,21 @@ def sap_disk_configurations(
else:
_json = None
- request = build_sap_disk_configurations_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -561,16 +530,12 @@ def sap_disk_configurations(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPDiskConfigurationsResult", pipeline_response)
+ deserialized = self._deserialize("SAPDiskConfigurationsResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- sap_disk_configurations.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations"
- }
+ return deserialized # type: ignore
@overload
def sap_availability_zone_details(
@@ -592,7 +557,6 @@ def sap_availability_zone_details(
: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.workloads.models.SAPAvailabilityZoneDetailsResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -602,7 +566,7 @@ def sap_availability_zone_details(
def sap_availability_zone_details(
self,
location: str,
- sap_availability_zone_details: Optional[IO] = None,
+ sap_availability_zone_details: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -613,11 +577,10 @@ def sap_availability_zone_details(
:type location: str
:param sap_availability_zone_details: SAP Availability Zone Details Request body. Default value
is None.
- :type sap_availability_zone_details: IO
+ :type sap_availability_zone_details: IO[bytes]
: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.workloads.models.SAPAvailabilityZoneDetailsResult
:raises ~azure.core.exceptions.HttpResponseError:
@@ -627,7 +590,7 @@ def sap_availability_zone_details(
def sap_availability_zone_details(
self,
location: str,
- sap_availability_zone_details: Optional[Union[_models.SAPAvailabilityZoneDetailsRequest, IO]] = None,
+ sap_availability_zone_details: Optional[Union[_models.SAPAvailabilityZoneDetailsRequest, IO[bytes]]] = None,
**kwargs: Any
) -> _models.SAPAvailabilityZoneDetailsResult:
"""Get the recommended SAP Availability Zone Pair Details for your region.
@@ -635,18 +598,14 @@ def sap_availability_zone_details(
: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.
+ SAPAvailabilityZoneDetailsRequest type or a IO[bytes] type. Default value is None.
:type sap_availability_zone_details:
- ~azure.mgmt.workloads.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
+ ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsRequest or IO[bytes]
:return: SAPAvailabilityZoneDetailsResult or the result of cls(response)
:rtype: ~azure.mgmt.workloads.models.SAPAvailabilityZoneDetailsResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -657,16 +616,14 @@ def sap_availability_zone_details(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-04-01"] = kwargs.pop(
- "api_version", _params.pop("api-version", self._config.api_version)
- )
+ 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, (IO, bytes)):
+ if isinstance(sap_availability_zone_details, (IOBase, bytes)):
_content = sap_availability_zone_details
else:
if sap_availability_zone_details is not None:
@@ -674,22 +631,21 @@ def sap_availability_zone_details(
else:
_json = None
- request = build_sap_availability_zone_details_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
+ _stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=False, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -699,13 +655,9 @@ def sap_availability_zone_details(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SAPAvailabilityZoneDetailsResult", pipeline_response)
+ deserialized = self._deserialize("SAPAvailabilityZoneDetailsResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- sap_availability_zone_details.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails"
- }
+ return deserialized # type: ignore
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/operations_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/operations_list.py
index e86f46b44146..21a701aee982 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/operations_list.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/operations_list.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_create.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_create.py
index 745c4190b5bc..de82f89ce63a 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_create.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_create_ha_av_set.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create_ha_av_set.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_create_ha_av_set.py
index 28c89e1188f4..7bfa9e264c9a 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_create_ha_av_set.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_create_ha_av_set.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_delete.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_delete.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_delete.py
index 7551aaf14169..6d47daabcacf 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_delete.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_delete.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_get.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_get.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_get.py
index fb697d6b186c..41bffabfc7e3 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_get.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_list.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_list.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_list.py
index 8039ae1c299f..54495a7dfcdb 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_list.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_list.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_start_instance.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_start_instance.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_start_instance.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_start_instance.py
index f96f97267a4b..4dcda0a6e0ce 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_start_instance.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_start_instance.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_stop_instance.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_stop_instance.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_stop_instance.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_stop_instance.py
index 8d2d835e98ca..afa08c927471 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_stop_instance.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_stop_instance.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_update.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_update.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_update.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_update.py
index f23277fd3c1f..b30e9e77d308 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_application_server_instances_update.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_application_server_instances_update.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_eastus.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_availability_zone_details_eastus.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_eastus.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_availability_zone_details_eastus.py
index 45fb7972922e..5dd9e05963b7 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_eastus.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_availability_zone_details_eastus.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_northeurope.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_availability_zone_details_northeurope.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_northeurope.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_availability_zone_details_northeurope.py
index 0c095c9d97a6..db9e656bbe2c 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_availability_zone_details_northeurope.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_availability_zone_details_northeurope.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_create.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_create.py
index ee30556b7c61..8b7c9455b367 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_create.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_create_ha_av_set.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create_ha_av_set.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_create_ha_av_set.py
index d336364e1ad4..5bfe7fb1a4b1 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_create_ha_av_set.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_create_ha_av_set.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_delete.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_delete.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_delete.py
index 62bda983702d..10617104fb82 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_delete.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_delete.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_get.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_get.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_get.py
index c7307e50515a..52f95a6dcfd8 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_get.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_list.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_list.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_list.py
index 20ea11911265..91b0f67f5927 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_list.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_list.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_start_instance.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_start_instance.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_start_instance.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_start_instance.py
index 7957fbbea4bd..cd59e22f7eea 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_start_instance.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_start_instance.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_stop_instance.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_stop_instance.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_stop_instance.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_stop_instance.py
index fb4c7ffc0595..fc835a36e83d 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_stop_instance.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_stop_instance.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_update.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_update.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_update.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_update.py
index 9d182ab308b5..682c41276b55 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_central_instances_update.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_central_instances_update.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_create.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_create.py
index efea3e5dbce9..484d4af3136a 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_create.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_create_ha_av_set.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create_ha_av_set.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_create_ha_av_set.py
index 826fb2976f70..4b6d5081ae6e 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_create_ha_av_set.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_create_ha_av_set.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_delete.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_delete.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_delete.py
index aa6d0c62ab24..1741c4a95097 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_delete.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_delete.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_get.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_get.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_get.py
index fb1a535cf907..105da022b25c 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_get.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_list.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_list.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_list.py
index e799ce7449ba..fc25f781e08b 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_list.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_list.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_start_instance.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_start_instance.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_start_instance.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_start_instance.py
index 2493ba3335f8..80c0369c2c68 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_start_instance.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_start_instance.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_stop_instance.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_stop_instance.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_stop_instance.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_stop_instance.py
index 16f4c031885b..e799ad95b4c6 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_stop_instance.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_stop_instance.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_update.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_update.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_update.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_update.py
index 879cf4224779..6f885d8572e0 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_database_instances_update.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_database_instances_update.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_non_prod.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_disk_configurations_non_prod.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_non_prod.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_disk_configurations_non_prod.py
index 399a5687da15..632449cfd1bf 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_non_prod.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_disk_configurations_non_prod.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_prod.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_disk_configurations_prod.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_prod.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_disk_configurations_prod.py
index 2d2634acb867..ba520a7e7116 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_disk_configurations_prod.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_disk_configurations_prod.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_distributed.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_distributed.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_distributed.py
index d231a42fe485..faa9c67e1a7a 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_distributed.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_distributed.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_set.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_set.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_set.py
index 2bf5e38b0f94..5e3cc489b551 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_set.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_set.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_zone.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_zone.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_zone.py
index 3f8c74e8e228..75c0eb5e93d3 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_ha_av_zone.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_ha_av_zone.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_single_server.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_single_server.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_single_server.py
index 4501d42bf057..e14296045b74 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_sizing_recommendations_s4_hana_single_server.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_sizing_recommendations_s4_hana_single_server.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_supported_skus_distributed.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_supported_skus_distributed.py
index 113031593271..d5443997bf8a 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_supported_skus_distributed.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_set.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_set.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_set.py
index dc71adb328f2..4245c058a00e 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_set.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_set.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_zone.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_zone.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_zone.py
index 0c25937bd0cc..9fc8d43ad232 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_distributed_ha_av_zone.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_supported_skus_distributed_ha_av_zone.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_supported_skus_single_server.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_single_server.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_supported_skus_single_server.py
index 33fcf3873793..755c54bd96e6 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_supported_skus_single_server.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_supported_skus_single_server.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_distributed.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_distributed.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_distributed.py
index b3235b09fb23..7744538da867 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_distributed.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_distributed.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py
index a078c70c1b33..ef9f5c9365af 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_set.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py
index 87100eae6580..6b4c9948a818 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_single_server.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_single_server.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_single_server.py
index 517b1a020fe7..4e4cb7f8bf89 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_custom_full_resource_names_single_server.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_custom_full_resource_names_single_server.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover.py
index a139d1b05cea..408ec8cff15a 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py
index e7eece30a872..25b15d30c4c9 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_discover_custom_mrg_storage_account_name.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_distributed.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_distributed.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_distributed.py
index 82f9dbb48cfd..025d32cbd437 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_distributed.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_distributed.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_set.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_ha_av_set.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_set.py
index bf92aa21e3a6..959ea3a5bd25 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_ha_av_set.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_set.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_zone.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_ha_av_zone.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_zone.py
index 707d2befa30a..e4770ed9c10c 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_ha_av_zone.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_ha_av_zone.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_single_server.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_single_server.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_single_server.py
index ea3d4fbd20e6..a1832bee2a18 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_disk_details_single_server.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_disk_details_single_server.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed.py
index b755aa24ea28..127c73f9e67a 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_create_transport.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_create_transport.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_create_transport.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_create_transport.py
index 02f71fe65a33..59c61b2f1b2f 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_create_transport.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_create_transport.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_mount_transport.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_mount_transport.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_mount_transport.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_mount_transport.py
index b03bc03092da..3aec17847ed2 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_mount_transport.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_mount_transport.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_skip_transport.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_skip_transport.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_skip_transport.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_skip_transport.py
index 97cc2cf2c786..e49ccbb498de 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_distributed_skip_transport.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_distributed_skip_transport.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_set.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_set.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_set.py
index 98aaf451869b..48ecd2d07e50 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_set.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_set.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_zone.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_zone.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_zone.py
index 78348df76192..2420f5873f11 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_ha_av_zone.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_ha_av_zone.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_single_server.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_single_server.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_single_server.py
index 6c69c9a64df2..13936e33e0a6 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_single_server.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_single_server.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_distributed.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_distributed.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_distributed.py
index 4be1f526181c..3a1e9ac48784 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_distributed.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_distributed.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_set.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_set.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_set.py
index 3646332a2604..6e72b44483aa 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_set.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_set.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_zone.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_zone.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_zone.py
index a3f89a0c84c3..37904fc18de2 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_ha_av_zone.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_ha_av_zone.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_single_server.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_single_server.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_single_server.py
index 7655df2281ce..914a9649df56 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_create_with_os_config_single_server.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_create_with_os_config_single_server.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_delete.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_delete.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_delete.py
index 67014ae8206f..f8108625d148 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_delete.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_delete.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_distributed.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_distributed.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_distributed.py
index 406e705f0643..6dbaf42bbb64 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_distributed.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_distributed.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_set.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_set.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_set.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_set.py
index d5e6fbc5398f..480411c3b1a2 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_set.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_set.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_zone.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_zone.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_zone.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_zone.py
index e4a99685ae73..c034fba7d186 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_ha_av_zone.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_ha_av_zone.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_single_server.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_single_server.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_single_server.py
index 6db79555b9b7..1b21e099452e 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_detect_installation_single_server.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_detect_installation_single_server.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_get.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_get.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_get.py
index 987d81763edd..25291596d78f 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_get.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_distributed.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_install_distributed.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_distributed.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_install_distributed.py
index fea960539bb0..6ed94e75d8f2 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_distributed.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_install_distributed.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_single_server.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_install_single_server.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_single_server.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_install_single_server.py
index ccccff34c778..4e9a32ca0ac5 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_install_single_server.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_install_single_server.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_resource_group.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_resource_group.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_resource_group.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_resource_group.py
index 7a27969e123e..c4ba5b8efcb5 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_resource_group.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_resource_group.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_subscription.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_subscription.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_subscription.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_subscription.py
index b7976a9e0490..d14799cfd06f 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_list_by_subscription.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_list_by_subscription.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_start.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_start.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_start.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_start.py
index d7ee54ca632b..494fa4f55d8c 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_start.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_start.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_stop.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_stop.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_stop.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_stop.py
index e0bcf4a35894..980dd63123ee 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_stop.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_stop.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_update.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_update.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_update.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_update.py
index a8b92f41f13e..5594498fa4cf 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_virtual_instances_update.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/sapvirtualinstances/sap_virtual_instances_update.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/db2_provider_instances_create.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/db2_provider_instances_create.py
index 215180de3e26..2669745d3e9b 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/db2_provider_instances_create.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create_root_certificate.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/db2_provider_instances_create_root_certificate.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create_root_certificate.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/db2_provider_instances_create_root_certificate.py
index cbda309016e1..6e8593181d85 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_create_root_certificate.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/db2_provider_instances_create_root_certificate.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/db2_provider_instances_get.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_get.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/db2_provider_instances_get.py
index a7ac1b275112..fdc0cf4b93af 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/db2_provider_instances_get.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/db2_provider_instances_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_delete.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_delete.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_delete.py
index c6322503ba03..83ce3146e6f3 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_delete.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_delete.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_get.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_get.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_get.py
index 5a9f2471243d..6988c4366041 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_get.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_list.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_list.py
index 5ed08b7ad26d..3c56deeca780 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_list.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list_by_rg.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_list_by_rg.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list_by_rg.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_list_by_rg.py
index bca4498907f6..fecf2fb4cdb6 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_list_by_rg.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_list_by_rg.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_patch_tags.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_patch_tags.py
index f95d719ab063..359c20b243fb 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_patch_tags.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_patch_tags_delete.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags_delete.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_patch_tags_delete.py
index e72947586ddc..aa22c48faaa2 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/monitors_patch_tags_delete.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/monitors_patch_tags_delete.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/ms_sql_server_provider_instance_create.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/ms_sql_server_provider_instance_create.py
index 5b5ffede6218..8aea665c25cb 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/ms_sql_server_provider_instance_create.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create_root_certificate.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/ms_sql_server_provider_instance_create_root_certificate.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create_root_certificate.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/ms_sql_server_provider_instance_create_root_certificate.py
index e8cdacbb53bf..d762212f75e5 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_create_root_certificate.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/ms_sql_server_provider_instance_create_root_certificate.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/ms_sql_server_provider_instance_get.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_get.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/ms_sql_server_provider_instance_get.py
index 931289fc11e9..d7d917b7b774 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/ms_sql_server_provider_instance_get.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/ms_sql_server_provider_instance_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/net_weaver_provider_instances_create.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/net_weaver_provider_instances_create.py
index 5aa042a514f3..d18c254dd947 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/net_weaver_provider_instances_create.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create_root_certificate.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/net_weaver_provider_instances_create_root_certificate.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create_root_certificate.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/net_weaver_provider_instances_create_root_certificate.py
index 9833de2aa766..f78a31f02d4b 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_create_root_certificate.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/net_weaver_provider_instances_create_root_certificate.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/net_weaver_provider_instances_get.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_get.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/net_weaver_provider_instances_get.py
index ea56765419d7..ef6469850d9b 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/net_weaver_provider_instances_get.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/net_weaver_provider_instances_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_ha_cluster_provider_instances_create.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_ha_cluster_provider_instances_create.py
index 044eeea994ef..06a7012b1781 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_ha_cluster_provider_instances_create.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create_root_certificate.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_ha_cluster_provider_instances_create_root_certificate.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create_root_certificate.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_ha_cluster_provider_instances_create_root_certificate.py
index d65437d6dc8a..5b9c80acc02a 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_create_root_certificate.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_ha_cluster_provider_instances_create_root_certificate.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_ha_cluster_provider_instances_get.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_get.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_ha_cluster_provider_instances_get.py
index 4cb35a8b621e..bfd59f115b27 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_ha_cluster_provider_instances_get.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_ha_cluster_provider_instances_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_os_provider_instances_create.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_os_provider_instances_create.py
index d065f0d57aa7..148f8306e10e 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_os_provider_instances_create.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create_root_certificate.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_os_provider_instances_create_root_certificate.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create_root_certificate.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_os_provider_instances_create_root_certificate.py
index d31aae02236c..0e6e153992d1 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_create_root_certificate.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_os_provider_instances_create_root_certificate.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_os_provider_instances_get.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_get.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_os_provider_instances_get.py
index 1c2e0e5f8b2f..13683186ef9e 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/prometheus_os_provider_instances_get.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/prometheus_os_provider_instances_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_create.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_create.py
index 6d287ea67a4b..2eef2010531a 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_create.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create_root_certificate.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_create_root_certificate.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create_root_certificate.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_create_root_certificate.py
index 989d2b9c1704..a9729a7d352c 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_create_root_certificate.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_create_root_certificate.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_delete.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_delete.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_delete.py
index b89d693bf7c1..6a4fc3af8c2c 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_delete.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_delete.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_get.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_get.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_get.py
index fa354dc31fd1..471b8ba53451 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_get.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_list.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_list.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_list.py
index ce0a185d9644..9319bae68172 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/provider_instances_list.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/provider_instances_list.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_create.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_create.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_create.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_create.py
index ef42c130f057..b95f55b7076c 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_create.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_create.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_delete.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_delete.py
similarity index 95%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_delete.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_delete.py
index 70687b494e0c..4d31f5b26aca 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_delete.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_delete.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
@@ -29,11 +30,10 @@ def main():
subscription_id="00000000-0000-0000-0000-000000000000",
)
- response = client.sap_landscape_monitor.delete(
+ client.sap_landscape_monitor.delete(
resource_group_name="myResourceGroup",
monitor_name="mySapMonitor",
)
- print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/workloadmonitor/SapLandscapeMonitor_Delete.json
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_get.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_get.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_get.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_get.py
index abcf13065130..cca791a2dcd1 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_get.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_list.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_list.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_list.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_list.py
index 3c1c71eecd00..27ee0782c966 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_list.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_list.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_update.py b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_update.py
similarity index 99%
rename from sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_update.py
rename to sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_update.py
index 61bc67d8b5ae..8ba3f926d483 100644
--- a/sdk/workloads/azure-mgmt-workloads/generated_samples/sap_landscape_monitor_update.py
+++ b/sdk/workloads/azure-mgmt-workloads/generated_samples/workloadmonitor/sap_landscape_monitor_update.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_tests/conftest.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/conftest.py
new file mode 100644
index 000000000000..74c7b129ab6b
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/conftest.py
@@ -0,0 +1,35 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import 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()
+
+
+# aovid record sensitive identity information in recordings
+@pytest.fixture(scope="session", autouse=True)
+def add_sanitizers(test_proxy):
+ workloadsmgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
+ workloadsmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
+ workloadsmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
+ workloadsmgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=workloadsmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=workloadsmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=workloadsmgmt_client_id, value="00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=workloadsmgmt_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-workloads/generated_tests/test_workloads_mgmt.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt.py
new file mode 100644
index 000000000000..2c769c5ada45
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt.py
@@ -0,0 +1,63 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmt(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_sap_sizing_recommendations(self, resource_group):
+ response = self.client.sap_sizing_recommendations(
+ location="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_sap_supported_sku(self, resource_group):
+ response = self.client.sap_supported_sku(
+ location="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_sap_disk_configurations(self, resource_group):
+ response = self.client.sap_disk_configurations(
+ location="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_sap_availability_zone_details(self, resource_group):
+ response = self.client.sap_availability_zone_details(
+ location="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_async.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_async.py
new file mode 100644
index 000000000000..ee77dc505541
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_async.py
@@ -0,0 +1,64 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads.aio import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_sap_sizing_recommendations(self, resource_group):
+ response = await self.client.sap_sizing_recommendations(
+ location="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_sap_supported_sku(self, resource_group):
+ response = await self.client.sap_supported_sku(
+ location="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_sap_disk_configurations(self, resource_group):
+ response = await self.client.sap_disk_configurations(
+ location="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_sap_availability_zone_details(self, resource_group):
+ response = await self.client.sap_availability_zone_details(
+ location="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_monitors_operations.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_monitors_operations.py
new file mode 100644
index 000000000000..bbd2db6e6a1c
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_monitors_operations.py
@@ -0,0 +1,146 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtMonitorsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.monitors.list(
+ api_version="2023-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_resource_group(self, resource_group):
+ response = self.client.monitors.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2023-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.monitors.get(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create(self, resource_group):
+ response = self.client.monitors.begin_create(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ monitor_parameter={
+ "location": "str",
+ "appLocation": "str",
+ "errors": {
+ "code": "str",
+ "details": [
+ {
+ "code": "str",
+ "details": [...],
+ "innerError": {"innerError": ...},
+ "message": "str",
+ "target": "str",
+ }
+ ],
+ "innerError": {
+ "innerError": {
+ "code": "str",
+ "details": [...],
+ "innerError": ...,
+ "message": "str",
+ "target": "str",
+ }
+ },
+ "message": "str",
+ "target": "str",
+ },
+ "id": "str",
+ "identity": {
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "logAnalyticsWorkspaceArmId": "str",
+ "managedResourceGroupConfiguration": {"name": "str"},
+ "monitorSubnet": "str",
+ "msiArmId": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "routingPreference": "str",
+ "storageAccountArmId": "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",
+ "zoneRedundancyPreference": "str",
+ },
+ api_version="2023-04-01",
+ ).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_begin_delete(self, resource_group):
+ response = self.client.monitors.begin_delete(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ api_version="2023-04-01",
+ ).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_update(self, resource_group):
+ response = self.client.monitors.update(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ body={
+ "identity": {
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "tags": {"str": "str"},
+ },
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_monitors_operations_async.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_monitors_operations_async.py
new file mode 100644
index 000000000000..ecf7583f7d53
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_monitors_operations_async.py
@@ -0,0 +1,151 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads.aio import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtMonitorsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.monitors.list(
+ api_version="2023-04-01",
+ )
+ 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_list_by_resource_group(self, resource_group):
+ response = self.client.monitors.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2023-04-01",
+ )
+ 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_get(self, resource_group):
+ response = await self.client.monitors.get(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create(self, resource_group):
+ response = await (
+ await self.client.monitors.begin_create(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ monitor_parameter={
+ "location": "str",
+ "appLocation": "str",
+ "errors": {
+ "code": "str",
+ "details": [
+ {
+ "code": "str",
+ "details": [...],
+ "innerError": {"innerError": ...},
+ "message": "str",
+ "target": "str",
+ }
+ ],
+ "innerError": {
+ "innerError": {
+ "code": "str",
+ "details": [...],
+ "innerError": ...,
+ "message": "str",
+ "target": "str",
+ }
+ },
+ "message": "str",
+ "target": "str",
+ },
+ "id": "str",
+ "identity": {
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "logAnalyticsWorkspaceArmId": "str",
+ "managedResourceGroupConfiguration": {"name": "str"},
+ "monitorSubnet": "str",
+ "msiArmId": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "routingPreference": "str",
+ "storageAccountArmId": "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",
+ "zoneRedundancyPreference": "str",
+ },
+ api_version="2023-04-01",
+ )
+ ).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_begin_delete(self, resource_group):
+ response = await (
+ await self.client.monitors.begin_delete(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ api_version="2023-04-01",
+ )
+ ).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_update(self, resource_group):
+ response = await self.client.monitors.update(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ body={
+ "identity": {
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "tags": {"str": "str"},
+ },
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_operations.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_operations.py
new file mode 100644
index 000000000000..dd4ae41a5363
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_operations.py
@@ -0,0 +1,29 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.operations.list(
+ api_version="2023-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_operations_async.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_operations_async.py
new file mode 100644
index 000000000000..e97c8b2677e0
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_operations_async.py
@@ -0,0 +1,30 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads.aio import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.operations.list(
+ api_version="2023-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_provider_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_provider_instances_operations.py
new file mode 100644
index 000000000000..f5e6f80706b3
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_provider_instances_operations.py
@@ -0,0 +1,112 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtProviderInstancesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.provider_instances.list(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ api_version="2023-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.provider_instances.get(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ provider_instance_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create(self, resource_group):
+ response = self.client.provider_instances.begin_create(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ provider_instance_name="str",
+ provider_instance_parameter={
+ "errors": {
+ "code": "str",
+ "details": [
+ {
+ "code": "str",
+ "details": [...],
+ "innerError": {"innerError": ...},
+ "message": "str",
+ "target": "str",
+ }
+ ],
+ "innerError": {
+ "innerError": {
+ "code": "str",
+ "details": [...],
+ "innerError": ...,
+ "message": "str",
+ "target": "str",
+ }
+ },
+ "message": "str",
+ "target": "str",
+ },
+ "id": "str",
+ "identity": {
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "name": "str",
+ "providerSettings": "provider_specific_properties",
+ "provisioningState": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "type": "str",
+ },
+ api_version="2023-04-01",
+ ).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_begin_delete(self, resource_group):
+ response = self.client.provider_instances.begin_delete(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ provider_instance_name="str",
+ api_version="2023-04-01",
+ ).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-workloads/generated_tests/test_workloads_mgmt_provider_instances_operations_async.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_provider_instances_operations_async.py
new file mode 100644
index 000000000000..3dd78a6cdf87
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_provider_instances_operations_async.py
@@ -0,0 +1,117 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads.aio import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtProviderInstancesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.provider_instances.list(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ api_version="2023-04-01",
+ )
+ 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_get(self, resource_group):
+ response = await self.client.provider_instances.get(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ provider_instance_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create(self, resource_group):
+ response = await (
+ await self.client.provider_instances.begin_create(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ provider_instance_name="str",
+ provider_instance_parameter={
+ "errors": {
+ "code": "str",
+ "details": [
+ {
+ "code": "str",
+ "details": [...],
+ "innerError": {"innerError": ...},
+ "message": "str",
+ "target": "str",
+ }
+ ],
+ "innerError": {
+ "innerError": {
+ "code": "str",
+ "details": [...],
+ "innerError": ...,
+ "message": "str",
+ "target": "str",
+ }
+ },
+ "message": "str",
+ "target": "str",
+ },
+ "id": "str",
+ "identity": {
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "name": "str",
+ "providerSettings": "provider_specific_properties",
+ "provisioningState": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "type": "str",
+ },
+ api_version="2023-04-01",
+ )
+ ).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_begin_delete(self, resource_group):
+ response = await (
+ await self.client.provider_instances.begin_delete(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ provider_instance_name="str",
+ api_version="2023-04-01",
+ )
+ ).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-workloads/generated_tests/test_workloads_mgmt_sap_application_server_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_application_server_instances_operations.py
new file mode 100644
index 000000000000..9079239d68bd
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_application_server_instances_operations.py
@@ -0,0 +1,109 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtSAPApplicationServerInstancesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_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",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_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",
+ api_version="2023-04-01",
+ ).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_begin_update(self, resource_group):
+ response = self.client.sap_application_server_instances.begin_update(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ application_instance_name="str",
+ api_version="2023-04-01",
+ ).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_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",
+ api_version="2023-04-01",
+ ).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_list(self, resource_group):
+ response = self.client.sap_application_server_instances.list(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_start_instance(self, resource_group):
+ response = self.client.sap_application_server_instances.begin_start_instance(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ application_instance_name="str",
+ api_version="2023-04-01",
+ ).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_begin_stop_instance(self, resource_group):
+ response = self.client.sap_application_server_instances.begin_stop_instance(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ application_instance_name="str",
+ api_version="2023-04-01",
+ ).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-workloads/generated_tests/test_workloads_mgmt_sap_application_server_instances_operations_async.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_application_server_instances_operations_async.py
new file mode 100644
index 000000000000..f22fb88592a0
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_application_server_instances_operations_async.py
@@ -0,0 +1,120 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads.aio import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtSAPApplicationServerInstancesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_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",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_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",
+ api_version="2023-04-01",
+ )
+ ).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_begin_update(self, resource_group):
+ response = await (
+ await self.client.sap_application_server_instances.begin_update(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ application_instance_name="str",
+ api_version="2023-04-01",
+ )
+ ).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_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",
+ api_version="2023-04-01",
+ )
+ ).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_list(self, resource_group):
+ response = self.client.sap_application_server_instances.list(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ )
+ 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_begin_start_instance(self, resource_group):
+ response = await (
+ await self.client.sap_application_server_instances.begin_start_instance(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ application_instance_name="str",
+ api_version="2023-04-01",
+ )
+ ).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_begin_stop_instance(self, resource_group):
+ response = await (
+ await self.client.sap_application_server_instances.begin_stop_instance(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ application_instance_name="str",
+ api_version="2023-04-01",
+ )
+ ).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-workloads/generated_tests/test_workloads_mgmt_sap_central_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_central_instances_operations.py
new file mode 100644
index 000000000000..49e5bf5818ff
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_central_instances_operations.py
@@ -0,0 +1,109 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtSAPCentralInstancesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.sap_central_instances.get(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ central_instance_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create(self, resource_group):
+ response = self.client.sap_central_instances.begin_create(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ central_instance_name="str",
+ api_version="2023-04-01",
+ ).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_begin_update(self, resource_group):
+ response = self.client.sap_central_instances.begin_update(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ central_instance_name="str",
+ api_version="2023-04-01",
+ ).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_begin_delete(self, resource_group):
+ response = self.client.sap_central_instances.begin_delete(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ central_instance_name="str",
+ api_version="2023-04-01",
+ ).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_list(self, resource_group):
+ response = self.client.sap_central_instances.list(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_start_instance(self, resource_group):
+ response = self.client.sap_central_instances.begin_start_instance(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ central_instance_name="str",
+ api_version="2023-04-01",
+ ).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_begin_stop_instance(self, resource_group):
+ response = self.client.sap_central_instances.begin_stop_instance(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ central_instance_name="str",
+ api_version="2023-04-01",
+ ).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-workloads/generated_tests/test_workloads_mgmt_sap_central_instances_operations_async.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_central_instances_operations_async.py
new file mode 100644
index 000000000000..d3472ff76eda
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_central_instances_operations_async.py
@@ -0,0 +1,120 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads.aio import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtSAPCentralInstancesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.sap_central_instances.get(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ central_instance_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create(self, resource_group):
+ response = await (
+ await self.client.sap_central_instances.begin_create(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ central_instance_name="str",
+ api_version="2023-04-01",
+ )
+ ).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_begin_update(self, resource_group):
+ response = await (
+ await self.client.sap_central_instances.begin_update(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ central_instance_name="str",
+ api_version="2023-04-01",
+ )
+ ).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_begin_delete(self, resource_group):
+ response = await (
+ await self.client.sap_central_instances.begin_delete(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ central_instance_name="str",
+ api_version="2023-04-01",
+ )
+ ).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_list(self, resource_group):
+ response = self.client.sap_central_instances.list(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ )
+ 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_begin_start_instance(self, resource_group):
+ response = await (
+ await self.client.sap_central_instances.begin_start_instance(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ central_instance_name="str",
+ api_version="2023-04-01",
+ )
+ ).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_begin_stop_instance(self, resource_group):
+ response = await (
+ await self.client.sap_central_instances.begin_stop_instance(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ central_instance_name="str",
+ api_version="2023-04-01",
+ )
+ ).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-workloads/generated_tests/test_workloads_mgmt_sap_database_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_database_instances_operations.py
new file mode 100644
index 000000000000..cd9904af6172
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_database_instances_operations.py
@@ -0,0 +1,109 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtSAPDatabaseInstancesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_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",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_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",
+ api_version="2023-04-01",
+ ).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_begin_update(self, resource_group):
+ response = self.client.sap_database_instances.begin_update(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ database_instance_name="str",
+ api_version="2023-04-01",
+ ).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_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",
+ api_version="2023-04-01",
+ ).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_list(self, resource_group):
+ response = self.client.sap_database_instances.list(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_start_instance(self, resource_group):
+ response = self.client.sap_database_instances.begin_start_instance(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ database_instance_name="str",
+ api_version="2023-04-01",
+ ).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_begin_stop_instance(self, resource_group):
+ response = self.client.sap_database_instances.begin_stop_instance(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ database_instance_name="str",
+ api_version="2023-04-01",
+ ).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-workloads/generated_tests/test_workloads_mgmt_sap_database_instances_operations_async.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_database_instances_operations_async.py
new file mode 100644
index 000000000000..32b25affde81
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_database_instances_operations_async.py
@@ -0,0 +1,120 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads.aio import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtSAPDatabaseInstancesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_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",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_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",
+ api_version="2023-04-01",
+ )
+ ).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_begin_update(self, resource_group):
+ response = await (
+ await self.client.sap_database_instances.begin_update(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ database_instance_name="str",
+ api_version="2023-04-01",
+ )
+ ).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_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",
+ api_version="2023-04-01",
+ )
+ ).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_list(self, resource_group):
+ response = self.client.sap_database_instances.list(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ )
+ 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_begin_start_instance(self, resource_group):
+ response = await (
+ await self.client.sap_database_instances.begin_start_instance(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ database_instance_name="str",
+ api_version="2023-04-01",
+ )
+ ).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_begin_stop_instance(self, resource_group):
+ response = await (
+ await self.client.sap_database_instances.begin_stop_instance(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ database_instance_name="str",
+ api_version="2023-04-01",
+ )
+ ).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-workloads/generated_tests/test_workloads_mgmt_sap_landscape_monitor_operations.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_landscape_monitor_operations.py
new file mode 100644
index 000000000000..1872e123135d
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_landscape_monitor_operations.py
@@ -0,0 +1,117 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtSapLandscapeMonitorOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.sap_landscape_monitor.get(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create(self, resource_group):
+ response = self.client.sap_landscape_monitor.create(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ sap_landscape_monitor_parameter={
+ "grouping": {
+ "landscape": [{"name": "str", "topSid": ["str"]}],
+ "sapApplication": [{"name": "str", "topSid": ["str"]}],
+ },
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topMetricsThresholds": [{"green": 0.0, "name": "str", "red": 0.0, "yellow": 0.0}],
+ "type": "str",
+ },
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_delete(self, resource_group):
+ response = self.client.sap_landscape_monitor.delete(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.sap_landscape_monitor.update(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ sap_landscape_monitor_parameter={
+ "grouping": {
+ "landscape": [{"name": "str", "topSid": ["str"]}],
+ "sapApplication": [{"name": "str", "topSid": ["str"]}],
+ },
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topMetricsThresholds": [{"green": 0.0, "name": "str", "red": 0.0, "yellow": 0.0}],
+ "type": "str",
+ },
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.sap_landscape_monitor.list(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_landscape_monitor_operations_async.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_landscape_monitor_operations_async.py
new file mode 100644
index 000000000000..44b9c3621235
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_landscape_monitor_operations_async.py
@@ -0,0 +1,118 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads.aio import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtSapLandscapeMonitorOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.sap_landscape_monitor.get(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create(self, resource_group):
+ response = await self.client.sap_landscape_monitor.create(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ sap_landscape_monitor_parameter={
+ "grouping": {
+ "landscape": [{"name": "str", "topSid": ["str"]}],
+ "sapApplication": [{"name": "str", "topSid": ["str"]}],
+ },
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topMetricsThresholds": [{"green": 0.0, "name": "str", "red": 0.0, "yellow": 0.0}],
+ "type": "str",
+ },
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_delete(self, resource_group):
+ response = await self.client.sap_landscape_monitor.delete(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.sap_landscape_monitor.update(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ sap_landscape_monitor_parameter={
+ "grouping": {
+ "landscape": [{"name": "str", "topSid": ["str"]}],
+ "sapApplication": [{"name": "str", "topSid": ["str"]}],
+ },
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topMetricsThresholds": [{"green": 0.0, "name": "str", "red": 0.0, "yellow": 0.0}],
+ "type": "str",
+ },
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = await self.client.sap_landscape_monitor.list(
+ resource_group_name=resource_group.name,
+ monitor_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_virtual_instances_operations.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_virtual_instances_operations.py
new file mode 100644
index 000000000000..cefaea130ccf
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_virtual_instances_operations.py
@@ -0,0 +1,112 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtSAPVirtualInstancesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create(self, resource_group):
+ response = self.client.sap_virtual_instances.begin_create(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ ).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_get(self, resource_group):
+ response = self.client.sap_virtual_instances.get(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_update(self, resource_group):
+ response = self.client.sap_virtual_instances.update(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_delete(self, resource_group):
+ response = self.client.sap_virtual_instances.begin_delete(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ ).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_list_by_resource_group(self, resource_group):
+ response = self.client.sap_virtual_instances.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2023-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_subscription(self, resource_group):
+ response = self.client.sap_virtual_instances.list_by_subscription(
+ api_version="2023-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_start(self, resource_group):
+ response = self.client.sap_virtual_instances.begin_start(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ ).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_begin_stop(self, resource_group):
+ response = self.client.sap_virtual_instances.begin_stop(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ ).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-workloads/generated_tests/test_workloads_mgmt_sap_virtual_instances_operations_async.py b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_virtual_instances_operations_async.py
new file mode 100644
index 000000000000..417142738afb
--- /dev/null
+++ b/sdk/workloads/azure-mgmt-workloads/generated_tests/test_workloads_mgmt_sap_virtual_instances_operations_async.py
@@ -0,0 +1,121 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.workloads.aio import WorkloadsMgmtClient
+
+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 TestWorkloadsMgmtSAPVirtualInstancesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(WorkloadsMgmtClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_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",
+ api_version="2023-04-01",
+ )
+ ).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_get(self, resource_group):
+ response = await self.client.sap_virtual_instances.get(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_update(self, resource_group):
+ response = await self.client.sap_virtual_instances.update(
+ resource_group_name=resource_group.name,
+ sap_virtual_instance_name="str",
+ api_version="2023-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_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",
+ api_version="2023-04-01",
+ )
+ ).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_list_by_resource_group(self, resource_group):
+ response = self.client.sap_virtual_instances.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2023-04-01",
+ )
+ 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_list_by_subscription(self, resource_group):
+ response = self.client.sap_virtual_instances.list_by_subscription(
+ api_version="2023-04-01",
+ )
+ 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_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",
+ api_version="2023-04-01",
+ )
+ ).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_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",
+ api_version="2023-04-01",
+ )
+ ).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-workloads/setup.py b/sdk/workloads/azure-mgmt-workloads/setup.py
index 94a302591e45..62c4e6da3388 100644
--- a/sdk/workloads/azure-mgmt-workloads/setup.py
+++ b/sdk/workloads/azure-mgmt-workloads/setup.py
@@ -1,10 +1,10 @@
#!/usr/bin/env python
-#-------------------------------------------------------------------------
+# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
-#--------------------------------------------------------------------------
+# --------------------------------------------------------------------------
import re
import os.path
@@ -16,64 +16,68 @@
PACKAGE_PPRINT_NAME = "Workloads Management"
# a-b-c => a/b/c
-package_folder_path = PACKAGE_NAME.replace('-', '/')
+package_folder_path = PACKAGE_NAME.replace("-", "/")
# a-b-c => a.b.c
-namespace_name = PACKAGE_NAME.replace('-', '.')
+namespace_name = PACKAGE_NAME.replace("-", ".")
# Version extraction inspired from 'requests'
-with open(os.path.join(package_folder_path, 'version.py')
- if os.path.exists(os.path.join(package_folder_path, 'version.py'))
- else os.path.join(package_folder_path, '_version.py'), 'r') as fd:
- version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
- fd.read(), re.MULTILINE).group(1)
+with open(
+ os.path.join(package_folder_path, "version.py")
+ if os.path.exists(os.path.join(package_folder_path, "version.py"))
+ else os.path.join(package_folder_path, "_version.py"),
+ "r",
+) as fd:
+ version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)
if not version:
- raise RuntimeError('Cannot find version information')
+ raise RuntimeError("Cannot find version information")
-with open('README.md', encoding='utf-8') as f:
+with open("README.md", encoding="utf-8") as f:
readme = f.read()
-with open('CHANGELOG.md', encoding='utf-8') as f:
+with open("CHANGELOG.md", encoding="utf-8") as f:
changelog = f.read()
setup(
name=PACKAGE_NAME,
version=version,
- description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME),
- long_description=readme + '\n\n' + changelog,
- long_description_content_type='text/markdown',
- license='MIT License',
- author='Microsoft Corporation',
- author_email='azpysdkhelp@microsoft.com',
- url='https://github.com/Azure/azure-sdk-for-python',
+ description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME),
+ long_description=readme + "\n\n" + changelog,
+ long_description_content_type="text/markdown",
+ license="MIT License",
+ author="Microsoft Corporation",
+ author_email="azpysdkhelp@microsoft.com",
+ url="https://github.com/Azure/azure-sdk-for-python",
keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product
classifiers=[
- 'Development Status :: 4 - Beta',
- 'Programming Language :: Python',
- 'Programming Language :: Python :: 3 :: Only',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.7',
- 'Programming Language :: Python :: 3.8',
- 'Programming Language :: Python :: 3.9',
- 'Programming Language :: Python :: 3.10',
- 'Programming Language :: Python :: 3.11',
- 'License :: OSI Approved :: MIT License',
+ "Development Status :: 4 - Beta",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3 :: Only",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
+ "License :: OSI Approved :: MIT License",
],
zip_safe=False,
- packages=find_packages(exclude=[
- 'tests',
- # Exclude packages that will be covered by PEP420 or nspkg
- 'azure',
- 'azure.mgmt',
- ]),
+ packages=find_packages(
+ exclude=[
+ "tests",
+ # Exclude packages that will be covered by PEP420 or nspkg
+ "azure",
+ "azure.mgmt",
+ ]
+ ),
include_package_data=True,
package_data={
- 'pytyped': ['py.typed'],
+ "pytyped": ["py.typed"],
},
install_requires=[
- "msrest>=0.7.1",
- "azure-common~=1.1",
- "azure-mgmt-core>=1.3.2,<2.0.0",
- "typing-extensions>=4.3.0; python_version<'3.8.0'",
+ "isodate>=0.6.1",
+ "typing-extensions>=4.6.0",
+ "azure-common>=1.1",
+ "azure-mgmt-core>=1.3.2",
],
- python_requires=">=3.7"
+ python_requires=">=3.8",
)