diff --git a/sdk/compute/azure-mgmt-compute/CHANGELOG.md b/sdk/compute/azure-mgmt-compute/CHANGELOG.md index b62258de44ae..b37ff3659b83 100644 --- a/sdk/compute/azure-mgmt-compute/CHANGELOG.md +++ b/sdk/compute/azure-mgmt-compute/CHANGELOG.md @@ -1,5 +1,50 @@ # Release History +## 35.0.0 (2025-04-23) + +### Features Added + + - Model AvailabilitySet has a new parameter system_data + - Model CapacityReservation has a new parameter system_data + - Model CapacityReservationGroup has a new parameter system_data + - Model DedicatedHost has a new parameter system_data + - Model DedicatedHostGroup has a new parameter system_data + - Model DedicatedHostSizeListResult has a new parameter next_link + - Model Disk has a new parameter system_data + - Model DiskAccess has a new parameter system_data + - Model DiskEncryptionSet has a new parameter system_data + - Model DiskRestorePoint has a new parameter system_data + - Model Image has a new parameter system_data + - Model PrivateEndpointConnection has a new parameter system_data + - Model ProximityPlacementGroup has a new parameter system_data + - Model ProxyResource has a new parameter system_data + - Model RestorePoint has a new parameter system_data + - Model RestorePointCollection has a new parameter system_data + - Model RollingUpgradeStatusInfo has a new parameter system_data + - Model Snapshot has a new parameter system_data + - Model SshPublicKeyResource has a new parameter system_data + - Model SystemData has a new parameter created_by + - Model SystemData has a new parameter created_by_type + - Model SystemData has a new parameter last_modified_by + - Model SystemData has a new parameter last_modified_by_type + - Model VirtualMachine has a new parameter system_data + - Model VirtualMachineExtension has a new parameter system_data + - Model VirtualMachineExtensionImage has a new parameter system_data + - Model VirtualMachineRunCommand has a new parameter system_data + - Model VirtualMachineScaleSet has a new parameter system_data + - Model VirtualMachineScaleSetExtension has a new parameter vm_name + - Model VirtualMachineScaleSetVM has a new parameter system_data + - Model VirtualMachineScaleSetVMExtension has a new parameter vm_name + - Model VirtualMachineSizeListResult has a new parameter next_link + +### Breaking Changes + + - Model VirtualMachineScaleSetExtension no longer has parameter name + - Model VirtualMachineScaleSetVMExtension no longer has parameter name + - Parameter location of model VirtualMachineExtension is now required + - Parameter value of model PrivateEndpointConnectionListResult is now required + - Parameter value of model RestorePointCollectionListResult is now required + ## 34.1.0 (2025-03-24) ### Features Added diff --git a/sdk/compute/azure-mgmt-compute/README.md b/sdk/compute/azure-mgmt-compute/README.md index 91cf3d114ce6..c52080ad46e3 100644 --- a/sdk/compute/azure-mgmt-compute/README.md +++ b/sdk/compute/azure-mgmt-compute/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Compute Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. 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.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/compute/azure-mgmt-compute/_meta.json b/sdk/compute/azure-mgmt-compute/_meta.json index af200276c392..b46e28833658 100644 --- a/sdk/compute/azure-mgmt-compute/_meta.json +++ b/sdk/compute/azure-mgmt-compute/_meta.json @@ -1,12 +1,12 @@ { - "commit": "85dbdf68f1c3e1693bd94eff5e8a869f1a07ed78", + "commit": "2504c146c24560d657445ac435b5bc4ee21c4189", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.27.4", + "@autorest/python@6.33.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/compute/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/azure-sdk-for-python/sdk --use=@autorest/python@6.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/compute/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.33.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/compute/resource-manager/readme.md", "package-2024-03-02-only": "2024-07-16 12:23:13 -0400 602fb5144a226577186e35845422c11db9067cf8 Microsoft.Compute/DiskRP/stable/2024-03-02/snapshot.json", "package-2024-03-01-only": "2024-06-05 15:03:47 -0700 491e00d17f24909ecf5e1030b3833bed51224e92 Microsoft.Compute/ComputeRP/stable/2024-03-01/virtualMachineScaleSet.json", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py index cfa78651fca7..14e0b4873e9d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -114,13 +116,18 @@ def __init__( credential: "TokenCredential", subscription_id: str, api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ComputeManagementClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -139,7 +146,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ComputeManagementClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_serialization.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_serialization.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_version.py index 73c4c36bd53b..ce330953651e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py index 159a9da0468d..d6e18eee367e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -114,13 +116,18 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = ComputeManagementClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ComputeManagementClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -139,7 +146,7 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ComputeManagementClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_compute_management_client.py index ac44ad6f8b99..c2208486c7f5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -67,7 +69,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-03-30". Note that overriding this default value may result in unsupported behavior. @@ -77,15 +79,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -104,7 +108,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_metadata.json index 4fdf9cae80bb..12ae200b45a8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_compute_management_client.py index 5bc4ac9cd8b2..271cd6a79b99 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -68,7 +70,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-03-30". Note that overriding this default value may result in unsupported behavior. @@ -78,15 +80,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -105,7 +109,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_operations.py index 1a2f99696cf2..4359c1abf27f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_operations.py @@ -6,8 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import ( Any, AsyncIterable, @@ -25,6 +25,7 @@ ) import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -46,6 +47,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_availability_sets_create_or_update_request, build_availability_sets_delete_request, @@ -105,11 +107,8 @@ build_virtual_machines_restart_request, build_virtual_machines_start_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -128,10 +127,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -627,10 +626,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -842,10 +841,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -1467,10 +1466,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -2958,10 +2957,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3291,10 +3290,10 @@ class UsageOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3390,10 +3389,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3489,10 +3488,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -5497,10 +5496,10 @@ class VirtualMachineScaleSetVMsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _reimage_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_compute_management_client_enums.py index 24b5b49944a3..315c9749872d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_compute_management_client_enums.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_models_py3.py index 8a99b716d5d2..7d59aef44845 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AdditionalUnattendContent(_serialization.Model): @@ -234,9 +229,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -324,7 +319,7 @@ def __init__( self.platform_update_domain_count = platform_update_domain_count self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None class AvailabilitySetListResult(_serialization.Model): @@ -418,8 +413,8 @@ class BootDiagnosticsInstanceView(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None + self.console_screenshot_blob_uri: Optional[str] = None + self.serial_console_log_blob_uri: Optional[str] = None class ComputeLongRunningOperationProperties(_serialization.Model): @@ -571,7 +566,7 @@ class DataDiskImage(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.lun = None + self.lun: Optional[int] = None class DiagnosticsProfile(_serialization.Model): @@ -679,7 +674,7 @@ class HardwareProfile(_serialization.Model): :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
`\\ :code:`
` The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: :code:`
`\\ :code:`
` `List all available virtual machine sizes in an availability set @@ -713,7 +708,7 @@ def __init__( """ :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
`\\ :code:`
` The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: :code:`
`\\ :code:`
` `List all available virtual machine sizes in an availability set @@ -1136,11 +1131,11 @@ class OperationStatusResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.status = None - self.start_time = None - self.end_time = None - self.error = None + self.name: Optional[str] = None + self.status: Optional[str] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None + self.error: Optional["_models.ApiError"] = None class OSDisk(_serialization.Model): @@ -1300,7 +1295,7 @@ class OSProfile(_serialization.Model): **Max-length (Windows):** 15 characters :code:`
`\\ :code:`
` **Max-length (Linux):** 64 characters. :code:`
`\\ :code:`
` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :vartype computer_name: str :ivar admin_username: Specifies the name of the administrator account. :code:`
`\\ :code:`
` **Windows-only restriction:** Cannot end in "." :code:`
`\\ :code:`
` @@ -1312,10 +1307,10 @@ class OSProfile(_serialization.Model): :code:`
`\\ :code:`
` **Max-length (Windows):** 20 characters :code:`
`\\ :code:`
`\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -1328,16 +1323,16 @@ class OSProfile(_serialization.Model): "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :vartype admin_password: str :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :vartype custom_data: str :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -1345,10 +1340,10 @@ class OSProfile(_serialization.Model): :ivar linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :vartype linux_configuration: ~azure.mgmt.compute.v2016_03_30.models.LinuxConfiguration :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. :vartype secrets: list[~azure.mgmt.compute.v2016_03_30.models.VaultSecretGroup] @@ -1382,7 +1377,7 @@ def __init__( **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :paramtype computer_name: str :keyword admin_username: Specifies the name of the administrator account. :code:`
    `\\ :code:`
    ` **Windows-only restriction:** Cannot end in "." :code:`
    `\\ :code:`
    ` @@ -1394,10 +1389,10 @@ def __init__( :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -1410,16 +1405,16 @@ def __init__( "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :paramtype admin_password: str :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :paramtype custom_data: str :keyword windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -1427,10 +1422,10 @@ def __init__( :keyword linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :paramtype linux_configuration: ~azure.mgmt.compute.v2016_03_30.models.LinuxConfiguration :keyword secrets: Specifies set of certificates that should be installed onto the virtual machine. @@ -1611,7 +1606,7 @@ class SshPublicKey(_serialization.Model): :ivar key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `\\ :code:`
    ` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. # pylint: disable=line-too-long + `_. :vartype key_data: str """ @@ -1629,7 +1624,7 @@ def __init__(self, *, path: Optional[str] = None, key_data: Optional[str] = None :keyword key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `\\ :code:`
    ` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. # pylint: disable=line-too-long + `_. :paramtype key_data: str """ super().__init__(**kwargs) @@ -1648,12 +1643,12 @@ class StorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2016_03_30.models.OSDisk :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2016_03_30.models.DataDisk] """ @@ -1680,12 +1675,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2016_03_30.models.OSDisk :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2016_03_30.models.DataDisk] """ super().__init__(**kwargs) @@ -1968,10 +1963,10 @@ class VirtualMachine(Resource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :vartype availability_set: ~azure.mgmt.compute.v2016_03_30.models.SubResource @@ -1986,7 +1981,7 @@ class VirtualMachine(Resource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar vm_id: Specifies the VM unique ID which is a 128-bits identifier that is encoded and @@ -2070,10 +2065,10 @@ def __init__( machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :paramtype availability_set: ~azure.mgmt.compute.v2016_03_30.models.SubResource @@ -2084,13 +2079,13 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str """ super().__init__(location=location, tags=tags, **kwargs) self.plan = plan - self.resources = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None self.identity = identity self.hardware_profile = hardware_profile self.storage_profile = storage_profile @@ -2098,10 +2093,10 @@ def __init__( self.network_profile = network_profile self.diagnostics_profile = diagnostics_profile self.availability_set = availability_set - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None class VirtualMachineAgentInstanceView(_serialization.Model): @@ -2339,7 +2334,7 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.instance_view = instance_view @@ -2661,8 +2656,8 @@ def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs :paramtype type: str """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -3009,7 +3004,7 @@ def __init__( self.identity = identity self.upgrade_policy = upgrade_policy self.virtual_machine_profile = virtual_machine_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.over_provision = over_provision @@ -3095,7 +3090,7 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class VirtualMachineScaleSetExtensionProfile(_serialization.Model): @@ -3156,8 +3151,8 @@ def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs :paramtype type: str """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -3193,8 +3188,8 @@ def __init__(self, *, statuses: Optional[List["_models.InstanceViewStatus"]] = N :paramtype statuses: list[~azure.mgmt.compute.v2016_03_30.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.virtual_machine = None - self.extensions = None + self.virtual_machine: Optional["_models.VirtualMachineScaleSetInstanceViewStatusesSummary"] = None + self.extensions: Optional[List["_models.VirtualMachineScaleSetVMExtensionsSummary"]] = None self.statuses = statuses @@ -3219,7 +3214,7 @@ class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.statuses_summary = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetIPConfiguration(SubResource): @@ -3602,10 +3597,10 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -3618,10 +3613,10 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :vartype admin_password: str :ivar custom_data: A base-64 encoded string of custom data. :vartype custom_data: str @@ -3669,10 +3664,10 @@ def __init__( :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -3685,10 +3680,10 @@ def __init__( "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :paramtype admin_password: str :keyword custom_data: A base-64 encoded string of custom data. :paramtype custom_data: str @@ -3737,9 +3732,9 @@ class VirtualMachineScaleSetSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.resource_type = None - self.sku = None - self.capacity = None + self.resource_type: Optional[str] = None + self.sku: Optional["_models.Sku"] = None + self.capacity: Optional["_models.VirtualMachineScaleSetSkuCapacity"] = None class VirtualMachineScaleSetSkuCapacity(_serialization.Model): @@ -3776,10 +3771,10 @@ class VirtualMachineScaleSetSkuCapacity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default_capacity = None - self.scale_type = None + self.minimum: Optional[int] = None + self.maximum: Optional[int] = None + self.default_capacity: Optional[int] = None + self.scale_type: Optional[Union[str, "_models.VirtualMachineScaleSetSkuScaleType"]] = None class VirtualMachineScaleSetStorageProfile(_serialization.Model): @@ -3866,10 +3861,10 @@ class VirtualMachineScaleSetVM(Resource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :vartype availability_set: ~azure.mgmt.compute.v2016_03_30.models.SubResource @@ -3882,7 +3877,7 @@ class VirtualMachineScaleSetVM(Resource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str """ @@ -3965,10 +3960,10 @@ def __init__( machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :paramtype availability_set: ~azure.mgmt.compute.v2016_03_30.models.SubResource @@ -3979,25 +3974,25 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str """ super().__init__(location=location, tags=tags, **kwargs) - self.instance_id = None - self.sku = None + self.instance_id: Optional[str] = None + self.sku: Optional["_models.Sku"] = None self.plan = plan - self.resources = None - self.latest_model_applied = None - self.vm_id = None - self.instance_view = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None + self.latest_model_applied: Optional[bool] = None + self.vm_id: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineScaleSetVMInstanceView"] = None self.hardware_profile = hardware_profile self.storage_profile = storage_profile self.os_profile = os_profile self.network_profile = network_profile self.diagnostics_profile = diagnostics_profile self.availability_set = availability_set - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.license_type = license_type @@ -4026,8 +4021,8 @@ class VirtualMachineScaleSetVMExtensionsSummary(_serialization.Model): # pylint def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.statuses_summary = None + self.name: Optional[str] = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetVMInstanceIDs(_serialization.Model): @@ -4358,8 +4353,8 @@ class VirtualMachineStatusCodeCount(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.count = None + self.code: Optional[str] = None + self.count: Optional[int] = None class WindowsConfiguration(_serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_operations.py index 3158f348adfc..1425c9c01161 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +56,7 @@ def build_availability_sets_create_or_update_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("name", name, "str"), @@ -91,7 +89,7 @@ def build_availability_sets_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -122,7 +120,7 @@ def build_availability_sets_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -179,7 +177,7 @@ def build_availability_sets_list_request(resource_group_name: str, subscription_ _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -209,7 +207,7 @@ def build_availability_sets_list_available_sizes_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -240,7 +238,7 @@ def build_virtual_machine_extension_images_get_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -273,7 +271,7 @@ def build_virtual_machine_extension_images_list_types_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -312,7 +310,7 @@ def build_virtual_machine_extension_images_list_versions_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -351,7 +349,7 @@ def build_virtual_machine_extensions_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -386,7 +384,7 @@ def build_virtual_machine_extensions_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -420,7 +418,7 @@ def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -458,7 +456,7 @@ def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -492,7 +490,7 @@ def build_virtual_machines_get_extensions_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -526,7 +524,7 @@ def build_virtual_machines_capture_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -560,7 +558,7 @@ def build_virtual_machines_create_or_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -593,7 +591,7 @@ def build_virtual_machines_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -629,7 +627,7 @@ def build_virtual_machines_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -662,7 +660,7 @@ def build_virtual_machines_deallocate_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -693,7 +691,7 @@ def build_virtual_machines_generalize_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -722,7 +720,7 @@ def build_virtual_machines_list_request(resource_group_name: str, subscription_i _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -776,7 +774,7 @@ def build_virtual_machines_list_available_sizes_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -807,7 +805,7 @@ def build_virtual_machines_power_off_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -838,7 +836,7 @@ def build_virtual_machines_restart_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -869,7 +867,7 @@ def build_virtual_machines_start_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -900,7 +898,7 @@ def build_virtual_machines_redeploy_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -931,7 +929,7 @@ def build_virtual_machine_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -974,7 +972,7 @@ def build_virtual_machine_images_list_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1013,7 +1011,7 @@ def build_virtual_machine_images_list_offers_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1043,7 +1041,7 @@ def build_virtual_machine_images_list_publishers_request( # pylint: disable=nam # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1073,7 +1071,7 @@ def build_virtual_machine_images_list_skus_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1102,7 +1100,7 @@ def build_usage_list_request(location: str, subscription_id: str, **kwargs: Any) # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1129,7 +1127,7 @@ def build_virtual_machine_sizes_list_request(location: str, subscription_id: str # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1160,7 +1158,7 @@ def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("name", name, "str"), @@ -1193,7 +1191,7 @@ def build_virtual_machine_scale_sets_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1224,7 +1222,7 @@ def build_virtual_machine_scale_sets_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1256,7 +1254,7 @@ def build_virtual_machine_scale_sets_deallocate_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1290,7 +1288,7 @@ def build_virtual_machine_scale_sets_delete_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1323,7 +1321,7 @@ def build_virtual_machine_scale_sets_get_instance_view_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1354,7 +1352,7 @@ def build_virtual_machine_scale_sets_list_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1412,7 +1410,7 @@ def build_virtual_machine_scale_sets_list_skus_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1444,7 +1442,7 @@ def build_virtual_machine_scale_sets_power_off_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1478,7 +1476,7 @@ def build_virtual_machine_scale_sets_restart_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1512,7 +1510,7 @@ def build_virtual_machine_scale_sets_start_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1546,7 +1544,7 @@ def build_virtual_machine_scale_sets_update_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1579,7 +1577,7 @@ def build_virtual_machine_scale_sets_reimage_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1610,7 +1608,7 @@ def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1642,7 +1640,7 @@ def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1674,7 +1672,7 @@ def build_virtual_machine_scale_set_vms_delete_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1706,7 +1704,7 @@ def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1738,7 +1736,7 @@ def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1777,7 +1775,7 @@ def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "virtualMachineScaleSetName": _SERIALIZER.url( @@ -1816,7 +1814,7 @@ def build_virtual_machine_scale_set_vms_power_off_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1848,7 +1846,7 @@ def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1880,7 +1878,7 @@ def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1913,10 +1911,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2409,10 +2407,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2624,10 +2622,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -3249,10 +3247,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4726,10 +4724,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5059,10 +5057,10 @@ class UsageOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5158,10 +5156,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5256,10 +5254,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -7251,10 +7249,10 @@ class VirtualMachineScaleSetVMsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _reimage_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_compute_management_client.py index 645c28ba3c18..69a9c1ed4f6c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -93,7 +95,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2017-03-30". Note that overriding this default value may result in unsupported behavior. @@ -103,15 +105,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -130,7 +134,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_metadata.json index 847c1cd1044a..e0126b4e4b4e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_compute_management_client.py index 7b73d0fb2f16..d644b4a1e021 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -94,7 +96,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2017-03-30". Note that overriding this default value may result in unsupported behavior. @@ -104,15 +106,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -131,7 +135,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_operations.py index 256ed581749c..213f4088d72a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_operations.py @@ -6,8 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import ( Any, AsyncIterable, @@ -25,6 +25,7 @@ ) import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -46,6 +47,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_availability_sets_create_or_update_request, build_availability_sets_delete_request, @@ -144,11 +146,8 @@ build_virtual_machines_run_command_request, build_virtual_machines_start_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -167,10 +166,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -670,10 +669,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -885,10 +884,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -1510,10 +1509,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3558,10 +3557,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3891,10 +3890,10 @@ class UsageOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3990,10 +3989,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4089,10 +4088,10 @@ class ImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -4607,10 +4606,10 @@ class ResourceSkusOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4703,10 +4702,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -7198,10 +7197,10 @@ class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -7697,10 +7696,10 @@ class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-t def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _cancel_initial( @@ -8002,10 +8001,10 @@ class VirtualMachineScaleSetVMsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _reimage_initial( @@ -9066,10 +9065,10 @@ class DisksOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -10084,10 +10083,10 @@ class SnapshotsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -11122,10 +11121,10 @@ class VirtualMachineRunCommandsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_compute_management_client_enums.py index 646a101a7f7d..239b67fad168 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_compute_management_client_enums.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_models_py3.py index fbe4e16ff51c..2d750fefb0d5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AccessUri(_serialization.Model): @@ -43,7 +38,7 @@ class AccessUri(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.access_sas = None + self.access_sas: Optional[str] = None class AdditionalUnattendContent(_serialization.Model): @@ -257,9 +252,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -354,7 +349,7 @@ def __init__( self.platform_update_domain_count = platform_update_domain_count self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None class AvailabilitySetListResult(_serialization.Model): @@ -448,8 +443,8 @@ class BootDiagnosticsInstanceView(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None + self.console_screenshot_blob_uri: Optional[str] = None + self.serial_console_log_blob_uri: Optional[str] = None class ComputeLongRunningOperationProperties(_serialization.Model): @@ -675,7 +670,7 @@ class DataDiskImage(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.lun = None + self.lun: Optional[int] = None class DiagnosticsProfile(_serialization.Model): @@ -809,15 +804,15 @@ def __init__( :paramtype encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings """ super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None + self.managed_by: Optional[str] = None self.sku = sku self.zones = zones - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.creation_data = creation_data self.disk_size_gb = disk_size_gb self.encryption_settings = encryption_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class DiskEncryptionSettings(_serialization.Model): @@ -965,7 +960,7 @@ def __init__(self, *, name: Optional[Union[str, "_models.StorageAccountTypes"]] """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class ResourceUpdate(_serialization.Model): @@ -1137,7 +1132,7 @@ class HardwareProfile(_serialization.Model): :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: :code:`
    `\\ :code:`
    ` `List all available virtual machine sizes in an availability set @@ -1178,7 +1173,7 @@ def __init__( """ :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: :code:`
    `\\ :code:`
    ` `List all available virtual machine sizes in an availability set @@ -1280,7 +1275,7 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ImageDataDisk(_serialization.Model): @@ -1647,13 +1642,13 @@ class ImageStorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. Required. :vartype os_disk: ~azure.mgmt.compute.v2017_03_30.models.ImageOSDisk :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2017_03_30.models.ImageDataDisk] """ @@ -1677,13 +1672,13 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. Required. :paramtype os_disk: ~azure.mgmt.compute.v2017_03_30.models.ImageOSDisk :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2017_03_30.models.ImageDataDisk] """ super().__init__(**kwargs) @@ -2183,11 +2178,11 @@ class OperationStatusResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.status = None - self.start_time = None - self.end_time = None - self.error = None + self.name: Optional[str] = None + self.status: Optional[str] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None + self.error: Optional["_models.ApiError"] = None class OSDisk(_serialization.Model): @@ -2352,7 +2347,7 @@ class OSProfile(_serialization.Model): **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :vartype computer_name: str :ivar admin_username: Specifies the name of the administrator account. :code:`
    `\\ :code:`
    ` **Windows-only restriction:** Cannot end in "." :code:`
    `\\ :code:`
    ` @@ -2364,10 +2359,10 @@ class OSProfile(_serialization.Model): :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -2380,16 +2375,16 @@ class OSProfile(_serialization.Model): "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :vartype admin_password: str :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :vartype custom_data: str :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -2397,10 +2392,10 @@ class OSProfile(_serialization.Model): :ivar linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :vartype linux_configuration: ~azure.mgmt.compute.v2017_03_30.models.LinuxConfiguration :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. :vartype secrets: list[~azure.mgmt.compute.v2017_03_30.models.VaultSecretGroup] @@ -2434,7 +2429,7 @@ def __init__( **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :paramtype computer_name: str :keyword admin_username: Specifies the name of the administrator account. :code:`
    `\\ :code:`
    ` **Windows-only restriction:** Cannot end in "." :code:`
    `\\ :code:`
    ` @@ -2446,10 +2441,10 @@ def __init__( :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -2462,16 +2457,16 @@ def __init__( "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :paramtype admin_password: str :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :paramtype custom_data: str :keyword windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -2479,10 +2474,10 @@ def __init__( :keyword linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :paramtype linux_configuration: ~azure.mgmt.compute.v2017_03_30.models.LinuxConfiguration :keyword secrets: Specifies set of certificates that should be installed onto the virtual machine. @@ -2659,18 +2654,18 @@ class ResourceSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.resource_type = None - self.name = None - self.tier = None - self.size = None - self.family = None - self.kind = None - self.capacity = None - self.locations = None - self.api_versions = None - self.costs = None - self.capabilities = None - self.restrictions = None + self.resource_type: Optional[str] = None + self.name: Optional[str] = None + self.tier: Optional[str] = None + self.size: Optional[str] = None + self.family: Optional[str] = None + self.kind: Optional[str] = None + self.capacity: Optional["_models.ResourceSkuCapacity"] = None + self.locations: Optional[List[str]] = None + self.api_versions: Optional[List[str]] = None + self.costs: Optional[List["_models.ResourceSkuCosts"]] = None + self.capabilities: Optional[List["_models.ResourceSkuCapabilities"]] = None + self.restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None class ResourceSkuCapabilities(_serialization.Model): @@ -2697,8 +2692,8 @@ class ResourceSkuCapabilities(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.value = None + self.name: Optional[str] = None + self.value: Optional[str] = None class ResourceSkuCapacity(_serialization.Model): @@ -2734,10 +2729,10 @@ class ResourceSkuCapacity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default = None - self.scale_type = None + self.minimum: Optional[int] = None + self.maximum: Optional[int] = None + self.default: Optional[int] = None + self.scale_type: Optional[Union[str, "_models.ResourceSkuCapacityScaleType"]] = None class ResourceSkuCosts(_serialization.Model): @@ -2768,9 +2763,9 @@ class ResourceSkuCosts(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None + self.meter_id: Optional[str] = None + self.quantity: Optional[int] = None + self.extended_unit: Optional[str] = None class ResourceSkuRestrictions(_serialization.Model): @@ -2804,9 +2799,9 @@ class ResourceSkuRestrictions(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.values = None - self.reason_code = None + self.type: Optional[Literal["Location"]] = None + self.values: Optional[List[str]] = None + self.reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None class ResourceSkusResult(_serialization.Model): @@ -2952,10 +2947,10 @@ class RollingUpgradeProgressInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successful_instance_count = None - self.failed_instance_count = None - self.in_progress_instance_count = None - self.pending_instance_count = None + self.successful_instance_count: Optional[int] = None + self.failed_instance_count: Optional[int] = None + self.in_progress_instance_count: Optional[int] = None + self.pending_instance_count: Optional[int] = None class RollingUpgradeRunningStatus(_serialization.Model): @@ -2992,10 +2987,10 @@ class RollingUpgradeRunningStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.last_action = None - self.last_action_time = None + self.code: Optional[Union[str, "_models.RollingUpgradeStatusCode"]] = None + self.start_time: Optional[datetime.datetime] = None + self.last_action: Optional[Union[str, "_models.RollingUpgradeActionType"]] = None + self.last_action_time: Optional[datetime.datetime] = None class RollingUpgradeStatusInfo(Resource): @@ -3057,10 +3052,10 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(location=location, tags=tags, **kwargs) - self.policy = None - self.running_status = None - self.progress = None - self.error = None + self.policy: Optional["_models.RollingUpgradePolicy"] = None + self.running_status: Optional["_models.RollingUpgradeRunningStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None class RunCommandDocumentBase(_serialization.Model): @@ -3548,14 +3543,14 @@ def __init__( :paramtype encryption_settings: ~azure.mgmt.compute.v2017_03_30.models.EncryptionSettings """ super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None + self.managed_by: Optional[str] = None self.sku = sku - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.creation_data = creation_data self.disk_size_gb = disk_size_gb self.encryption_settings = encryption_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class SnapshotList(_serialization.Model): @@ -3701,7 +3696,7 @@ class SshPublicKey(_serialization.Model): :ivar key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `\\ :code:`
    ` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. # pylint: disable=line-too-long + `_. :vartype key_data: str """ @@ -3719,7 +3714,7 @@ def __init__(self, *, path: Optional[str] = None, key_data: Optional[str] = None :keyword key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `\\ :code:`
    ` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. # pylint: disable=line-too-long + `_. :paramtype key_data: str """ super().__init__(**kwargs) @@ -3738,12 +3733,12 @@ class StorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2017_03_30.models.OSDisk :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2017_03_30.models.DataDisk] """ @@ -3770,12 +3765,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2017_03_30.models.OSDisk :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2017_03_30.models.DataDisk] """ super().__init__(**kwargs) @@ -3804,7 +3799,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class UpdateResource(_serialization.Model): @@ -4106,10 +4101,10 @@ class VirtualMachine(Resource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :vartype availability_set: ~azure.mgmt.compute.v2017_03_30.models.SubResource @@ -4124,7 +4119,7 @@ class VirtualMachine(Resource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar vm_id: Specifies the VM unique ID which is a 128-bits identifier that is encoded and @@ -4212,10 +4207,10 @@ def __init__( machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :paramtype availability_set: ~azure.mgmt.compute.v2017_03_30.models.SubResource @@ -4226,13 +4221,13 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str """ super().__init__(location=location, tags=tags, **kwargs) self.plan = plan - self.resources = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None self.identity = identity self.zones = zones self.hardware_profile = hardware_profile @@ -4241,10 +4236,10 @@ def __init__( self.network_profile = network_profile self.diagnostics_profile = diagnostics_profile self.availability_set = availability_set - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None class VirtualMachineAgentInstanceView(_serialization.Model): @@ -4482,7 +4477,7 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.instance_view = instance_view @@ -4790,7 +4785,7 @@ class VirtualMachineHealthStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None + self.status: Optional["_models.InstanceViewStatus"] = None class VirtualMachineIdentity(_serialization.Model): @@ -4827,8 +4822,8 @@ def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs :paramtype type: str """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -5219,9 +5214,9 @@ def __init__( self.zones = zones self.upgrade_policy = upgrade_policy self.virtual_machine_profile = virtual_machine_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.overprovision = overprovision - self.unique_id = None + self.unique_id: Optional[str] = None self.single_placement_group = single_placement_group @@ -5405,7 +5400,7 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class VirtualMachineScaleSetExtensionListResult(_serialization.Model): # pylint: disable=name-too-long @@ -5502,8 +5497,8 @@ def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs :paramtype type: str """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -5539,8 +5534,8 @@ def __init__(self, *, statuses: Optional[List["_models.InstanceViewStatus"]] = N :paramtype statuses: list[~azure.mgmt.compute.v2017_03_30.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.virtual_machine = None - self.extensions = None + self.virtual_machine: Optional["_models.VirtualMachineScaleSetInstanceViewStatusesSummary"] = None + self.extensions: Optional[List["_models.VirtualMachineScaleSetVMExtensionsSummary"]] = None self.statuses = statuses @@ -5565,7 +5560,7 @@ class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.statuses_summary = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetIPConfiguration(SubResource): @@ -5933,7 +5928,7 @@ class VirtualMachineScaleSetNetworkProfile(_serialization.Model): :ivar health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :vartype health_probe: ~azure.mgmt.compute.v2017_03_30.models.ApiEntityReference :ivar network_interface_configurations: The list of network configurations. :vartype network_interface_configurations: @@ -5958,7 +5953,7 @@ def __init__( """ :keyword health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :paramtype health_probe: ~azure.mgmt.compute.v2017_03_30.models.ApiEntityReference :keyword network_interface_configurations: The list of network configurations. :paramtype network_interface_configurations: @@ -6086,10 +6081,10 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -6102,16 +6097,16 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :vartype admin_password: str :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :vartype custom_data: str :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -6119,10 +6114,10 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): :ivar linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :vartype linux_configuration: ~azure.mgmt.compute.v2017_03_30.models.LinuxConfiguration :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines in the scale set. @@ -6165,10 +6160,10 @@ def __init__( :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -6181,16 +6176,16 @@ def __init__( "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :paramtype admin_password: str :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :paramtype custom_data: str :keyword windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -6198,10 +6193,10 @@ def __init__( :keyword linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :paramtype linux_configuration: ~azure.mgmt.compute.v2017_03_30.models.LinuxConfiguration :keyword secrets: Specifies set of certificates that should be installed onto the virtual machines in the scale set. @@ -6327,9 +6322,9 @@ class VirtualMachineScaleSetSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.resource_type = None - self.sku = None - self.capacity = None + self.resource_type: Optional[str] = None + self.sku: Optional["_models.Sku"] = None + self.capacity: Optional["_models.VirtualMachineScaleSetSkuCapacity"] = None class VirtualMachineScaleSetSkuCapacity(_serialization.Model): @@ -6366,10 +6361,10 @@ class VirtualMachineScaleSetSkuCapacity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default_capacity = None - self.scale_type = None + self.minimum: Optional[int] = None + self.maximum: Optional[int] = None + self.default_capacity: Optional[int] = None + self.scale_type: Optional[Union[str, "_models.VirtualMachineScaleSetSkuScaleType"]] = None class VirtualMachineScaleSetStorageProfile(_serialization.Model): @@ -6383,12 +6378,12 @@ class VirtualMachineScaleSetStorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetOSDisk :ivar data_disks: Specifies the parameters that are used to add data disks to the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetDataDisk] """ @@ -6416,12 +6411,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetOSDisk :keyword data_disks: Specifies the parameters that are used to add data disks to the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetDataDisk] """ @@ -7036,10 +7031,10 @@ class VirtualMachineScaleSetVM(Resource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :vartype availability_set: ~azure.mgmt.compute.v2017_03_30.models.SubResource @@ -7052,7 +7047,7 @@ class VirtualMachineScaleSetVM(Resource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str """ @@ -7135,10 +7130,10 @@ def __init__( machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :paramtype availability_set: ~azure.mgmt.compute.v2017_03_30.models.SubResource @@ -7149,25 +7144,25 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str """ super().__init__(location=location, tags=tags, **kwargs) - self.instance_id = None - self.sku = None + self.instance_id: Optional[str] = None + self.sku: Optional["_models.Sku"] = None self.plan = plan - self.resources = None - self.latest_model_applied = None - self.vm_id = None - self.instance_view = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None + self.latest_model_applied: Optional[bool] = None + self.vm_id: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineScaleSetVMInstanceView"] = None self.hardware_profile = hardware_profile self.storage_profile = storage_profile self.os_profile = os_profile self.network_profile = network_profile self.diagnostics_profile = diagnostics_profile self.availability_set = availability_set - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.license_type = license_type @@ -7196,8 +7191,8 @@ class VirtualMachineScaleSetVMExtensionsSummary(_serialization.Model): # pylint def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.statuses_summary = None + self.name: Optional[str] = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetVMInstanceIDs(_serialization.Model): @@ -7345,7 +7340,7 @@ def __init__( self.vm_agent = vm_agent self.disks = disks self.extensions = extensions - self.vm_health = None + self.vm_health: Optional["_models.VirtualMachineHealthStatus"] = None self.boot_diagnostics = boot_diagnostics self.statuses = statuses self.placement_group_id = placement_group_id @@ -7414,7 +7409,7 @@ class VirtualMachineScaleSetVMProfile(_serialization.Model): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str """ @@ -7464,7 +7459,7 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str """ @@ -7585,8 +7580,8 @@ class VirtualMachineStatusCodeCount(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.count = None + self.code: Optional[str] = None + self.count: Optional[int] = None class WindowsConfiguration(_serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_operations.py index e3e5bf509f49..3796f4ed366b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +56,7 @@ def build_availability_sets_create_or_update_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -91,7 +89,7 @@ def build_availability_sets_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -122,7 +120,7 @@ def build_availability_sets_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -179,7 +177,7 @@ def build_availability_sets_list_request(resource_group_name: str, subscription_ _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -209,7 +207,7 @@ def build_availability_sets_list_available_sizes_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -240,7 +238,7 @@ def build_virtual_machine_extension_images_get_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -273,7 +271,7 @@ def build_virtual_machine_extension_images_list_types_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -312,7 +310,7 @@ def build_virtual_machine_extension_images_list_versions_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -351,7 +349,7 @@ def build_virtual_machine_extensions_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -386,7 +384,7 @@ def build_virtual_machine_extensions_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -420,7 +418,7 @@ def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -458,7 +456,7 @@ def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -492,7 +490,7 @@ def build_virtual_machines_get_extensions_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -525,7 +523,7 @@ def build_virtual_machines_list_by_location_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -556,7 +554,7 @@ def build_virtual_machines_capture_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -590,7 +588,7 @@ def build_virtual_machines_create_or_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -623,7 +621,7 @@ def build_virtual_machines_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -659,7 +657,7 @@ def build_virtual_machines_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -692,7 +690,7 @@ def build_virtual_machines_instance_view_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -723,7 +721,7 @@ def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -754,7 +752,7 @@ def build_virtual_machines_deallocate_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -785,7 +783,7 @@ def build_virtual_machines_generalize_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -814,7 +812,7 @@ def build_virtual_machines_list_request(resource_group_name: str, subscription_i _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -868,7 +866,7 @@ def build_virtual_machines_list_available_sizes_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -899,7 +897,7 @@ def build_virtual_machines_power_off_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -930,7 +928,7 @@ def build_virtual_machines_restart_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -961,7 +959,7 @@ def build_virtual_machines_start_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -992,7 +990,7 @@ def build_virtual_machines_redeploy_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1023,7 +1021,7 @@ def build_virtual_machines_perform_maintenance_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1055,7 +1053,7 @@ def build_virtual_machines_run_command_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1088,7 +1086,7 @@ def build_virtual_machine_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1131,7 +1129,7 @@ def build_virtual_machine_images_list_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1170,7 +1168,7 @@ def build_virtual_machine_images_list_offers_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1200,7 +1198,7 @@ def build_virtual_machine_images_list_publishers_request( # pylint: disable=nam # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1230,7 +1228,7 @@ def build_virtual_machine_images_list_skus_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1259,7 +1257,7 @@ def build_usage_list_request(location: str, subscription_id: str, **kwargs: Any) # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1286,7 +1284,7 @@ def build_virtual_machine_sizes_list_request(location: str, subscription_id: str # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1317,7 +1315,7 @@ def build_images_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -1350,7 +1348,7 @@ def build_images_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -1381,7 +1379,7 @@ def build_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -1414,7 +1412,7 @@ def build_images_list_by_resource_group_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1493,7 +1491,7 @@ def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1527,7 +1525,7 @@ def build_virtual_machine_scale_sets_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1560,7 +1558,7 @@ def build_virtual_machine_scale_sets_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1591,7 +1589,7 @@ def build_virtual_machine_scale_sets_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1623,7 +1621,7 @@ def build_virtual_machine_scale_sets_deallocate_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1657,7 +1655,7 @@ def build_virtual_machine_scale_sets_delete_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1690,7 +1688,7 @@ def build_virtual_machine_scale_sets_get_instance_view_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1721,7 +1719,7 @@ def build_virtual_machine_scale_sets_list_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1779,7 +1777,7 @@ def build_virtual_machine_scale_sets_list_skus_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1811,7 +1809,7 @@ def build_virtual_machine_scale_sets_power_off_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1845,7 +1843,7 @@ def build_virtual_machine_scale_sets_restart_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1879,7 +1877,7 @@ def build_virtual_machine_scale_sets_start_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1913,7 +1911,7 @@ def build_virtual_machine_scale_sets_update_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1947,7 +1945,7 @@ def build_virtual_machine_scale_sets_reimage_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1981,7 +1979,7 @@ def build_virtual_machine_scale_sets_reimage_all_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2015,7 +2013,7 @@ def build_virtual_machine_scale_set_extensions_create_or_update_request( # pyli _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2049,7 +2047,7 @@ def build_virtual_machine_scale_set_extensions_delete_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2087,7 +2085,7 @@ def build_virtual_machine_scale_set_extensions_get_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2121,7 +2119,7 @@ def build_virtual_machine_scale_set_extensions_list_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2152,7 +2150,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_cancel_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2183,7 +2181,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2214,7 +2212,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( # pyli _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2245,7 +2243,7 @@ def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2277,7 +2275,7 @@ def build_virtual_machine_scale_set_vms_reimage_all_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2309,7 +2307,7 @@ def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2341,7 +2339,7 @@ def build_virtual_machine_scale_set_vms_delete_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2373,7 +2371,7 @@ def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2405,7 +2403,7 @@ def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2444,7 +2442,7 @@ def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "virtualMachineScaleSetName": _SERIALIZER.url( @@ -2483,7 +2481,7 @@ def build_virtual_machine_scale_set_vms_power_off_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2515,7 +2513,7 @@ def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2547,7 +2545,7 @@ def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2580,7 +2578,7 @@ def build_disks_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2614,7 +2612,7 @@ def build_disks_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2647,7 +2645,7 @@ def build_disks_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2678,7 +2676,7 @@ def build_disks_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2709,7 +2707,7 @@ def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2764,7 +2762,7 @@ def build_disks_grant_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2797,7 +2795,7 @@ def build_disks_revoke_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2829,7 +2827,7 @@ def build_snapshots_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2863,7 +2861,7 @@ def build_snapshots_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2896,7 +2894,7 @@ def build_snapshots_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2927,7 +2925,7 @@ def build_snapshots_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -2958,7 +2956,7 @@ def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3013,7 +3011,7 @@ def build_snapshots_grant_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3046,7 +3044,7 @@ def build_snapshots_revoke_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3076,7 +3074,7 @@ def build_virtual_machine_run_commands_list_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -3106,7 +3104,7 @@ def build_virtual_machine_run_commands_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "commandId": _SERIALIZER.url("command_id", command_id, "str"), @@ -3138,10 +3136,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -3638,10 +3636,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3853,10 +3851,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -4478,10 +4476,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6503,10 +6501,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6836,10 +6834,10 @@ class UsageOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6935,10 +6933,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7033,10 +7031,10 @@ class ImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -7551,10 +7549,10 @@ class ResourceSkusOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7646,10 +7644,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -10129,10 +10127,10 @@ class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -10628,10 +10626,10 @@ class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-t def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -10929,10 +10927,10 @@ class VirtualMachineScaleSetVMsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _reimage_initial( @@ -11987,10 +11985,10 @@ class DisksOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -12999,10 +12997,10 @@ class SnapshotsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -14021,10 +14019,10 @@ class VirtualMachineRunCommandsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_compute_management_client.py index bb560db6ed03..f677d8e0639a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -34,7 +36,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2017-09-01". Note that overriding this default value may result in unsupported behavior. @@ -42,15 +44,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -69,7 +73,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_metadata.json index c2892ce544ba..f0e87a75f1c6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_compute_management_client.py index 14074d8aa16a..57f0eb2283f4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -34,7 +36,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2017-09-01". Note that overriding this default value may result in unsupported behavior. @@ -42,15 +44,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -69,7 +73,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/operations/_operations.py index 4e92991dbd38..050e358daf29 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/operations/_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import build_resource_skus_list_request +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -49,10 +48,10 @@ class ResourceSkusOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_models_py3.py index 80780c97f346..f908f398c1be 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/models/_models_py3.py @@ -86,19 +86,19 @@ class ResourceSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.resource_type = None - self.name = None - self.tier = None - self.size = None - self.family = None - self.kind = None - self.capacity = None - self.locations = None - self.location_info = None - self.api_versions = None - self.costs = None - self.capabilities = None - self.restrictions = None + self.resource_type: Optional[str] = None + self.name: Optional[str] = None + self.tier: Optional[str] = None + self.size: Optional[str] = None + self.family: Optional[str] = None + self.kind: Optional[str] = None + self.capacity: Optional["_models.ResourceSkuCapacity"] = None + self.locations: Optional[List[str]] = None + self.location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None + self.api_versions: Optional[List[str]] = None + self.costs: Optional[List["_models.ResourceSkuCosts"]] = None + self.capabilities: Optional[List["_models.ResourceSkuCapabilities"]] = None + self.restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None class ResourceSkuCapabilities(_serialization.Model): @@ -125,8 +125,8 @@ class ResourceSkuCapabilities(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.value = None + self.name: Optional[str] = None + self.value: Optional[str] = None class ResourceSkuCapacity(_serialization.Model): @@ -162,10 +162,10 @@ class ResourceSkuCapacity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default = None - self.scale_type = None + self.minimum: Optional[int] = None + self.maximum: Optional[int] = None + self.default: Optional[int] = None + self.scale_type: Optional[Union[str, "_models.ResourceSkuCapacityScaleType"]] = None class ResourceSkuCosts(_serialization.Model): @@ -196,9 +196,9 @@ class ResourceSkuCosts(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None + self.meter_id: Optional[str] = None + self.quantity: Optional[int] = None + self.extended_unit: Optional[str] = None class ResourceSkuLocationInfo(_serialization.Model): @@ -225,8 +225,8 @@ class ResourceSkuLocationInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.location = None - self.zones = None + self.location: Optional[str] = None + self.zones: Optional[List[str]] = None class ResourceSkuRestrictionInfo(_serialization.Model): @@ -253,8 +253,8 @@ class ResourceSkuRestrictionInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.locations = None - self.zones = None + self.locations: Optional[List[str]] = None + self.zones: Optional[List[str]] = None class ResourceSkuRestrictions(_serialization.Model): @@ -292,10 +292,10 @@ class ResourceSkuRestrictions(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.values = None - self.restriction_info = None - self.reason_code = None + self.type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None + self.values: Optional[List[str]] = None + self.restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None + self.reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None class ResourceSkusResult(_serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/operations/_operations.py index 955e4ffa5415..ca2366b1b717 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/operations/_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,10 +74,10 @@ class ResourceSkusOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_compute_management_client.py index 084179dfb559..f5893d30f6da 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -90,7 +92,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2017-12-01". Note that overriding this default value may result in unsupported behavior. @@ -100,15 +102,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -127,7 +131,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_metadata.json index f6fdf68f654b..4737040bbe22 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_compute_management_client.py index 7d6e68ea22f2..382d598dd4f7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -91,7 +93,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2017-12-01". Note that overriding this default value may result in unsupported behavior. @@ -101,15 +103,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -128,7 +132,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py index c8ab3fcff401..5c0c78e6adbe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import ( Any, AsyncIterable, @@ -25,6 +25,7 @@ ) import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -46,6 +47,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_availability_sets_create_or_update_request, build_availability_sets_delete_request, @@ -140,11 +142,8 @@ build_virtual_machines_start_request, build_virtual_machines_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -163,10 +162,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -259,10 +258,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -889,10 +888,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -1104,10 +1103,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -1729,10 +1728,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3969,10 +3968,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4302,10 +4301,10 @@ class UsageOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4401,10 +4400,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4500,10 +4499,10 @@ class ImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -5204,10 +5203,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -6470,7 +6469,6 @@ async def get_next(next_link=None): def get_os_upgrade_history( self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncIterable["_models.UpgradeOperationHistoricalStatusInfo"]: - # pylint: disable=line-too-long """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. Required. @@ -8261,10 +8259,10 @@ class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -8760,10 +8758,10 @@ class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-t def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _cancel_initial( @@ -9065,10 +9063,10 @@ class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-me def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _reimage_initial( @@ -10573,10 +10571,10 @@ class LogAnalyticsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _export_request_rate_by_interval_initial( @@ -10947,10 +10945,10 @@ class VirtualMachineRunCommandsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_compute_management_client_enums.py index 9275d1b7e195..16a7ce23d0b3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_compute_management_client_enums.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_models_py3.py index f75f809a9c3c..e938428ded1b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AdditionalUnattendContent(_serialization.Model): @@ -256,9 +251,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -353,7 +348,7 @@ def __init__( self.platform_update_domain_count = platform_update_domain_count self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None class AvailabilitySetListResult(_serialization.Model): @@ -473,7 +468,7 @@ def __init__( self.platform_update_domain_count = platform_update_domain_count self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None class BootDiagnostics(_serialization.Model): @@ -531,8 +526,8 @@ class BootDiagnosticsInstanceView(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None + self.console_screenshot_blob_uri: Optional[str] = None + self.serial_console_log_blob_uri: Optional[str] = None class ComputeLongRunningOperationProperties(_serialization.Model): @@ -575,7 +570,7 @@ class ComputeOperationListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None + self.value: Optional[List["_models.ComputeOperationValue"]] = None class ComputeOperationValue(_serialization.Model): @@ -618,12 +613,12 @@ class ComputeOperationValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.origin = None - self.name = None - self.operation = None - self.resource = None - self.description = None - self.provider = None + self.origin: Optional[str] = None + self.name: Optional[str] = None + self.operation: Optional[str] = None + self.resource: Optional[str] = None + self.description: Optional[str] = None + self.provider: Optional[str] = None class DataDisk(_serialization.Model): @@ -769,7 +764,7 @@ class DataDiskImage(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.lun = None + self.lun: Optional[int] = None class DiagnosticsProfile(_serialization.Model): @@ -888,7 +883,7 @@ class HardwareProfile(_serialization.Model): :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: :code:`
    `\\ :code:`
    ` `List all available virtual machine sizes in an availability set @@ -945,7 +940,7 @@ def __init__( """ :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: :code:`
    `\\ :code:`
    ` `List all available virtual machine sizes in an availability set @@ -1063,7 +1058,7 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ImageDataDisk(_serialization.Model): @@ -1390,12 +1385,12 @@ class ImageStorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2017_12_01.models.ImageOSDisk :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2017_12_01.models.ImageDataDisk] :ivar zone_resilient: Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). @@ -1420,12 +1415,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2017_12_01.models.ImageOSDisk :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2017_12_01.models.ImageDataDisk] :keyword zone_resilient: Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). @@ -1482,7 +1477,7 @@ def __init__( super().__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class InnerError(_serialization.Model): @@ -1812,11 +1807,11 @@ class OperationStatusResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.status = None - self.start_time = None - self.end_time = None - self.error = None + self.name: Optional[str] = None + self.status: Optional[str] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None + self.error: Optional["_models.ApiError"] = None class LogAnalyticsOperationResult(OperationStatusResponse): @@ -1859,7 +1854,7 @@ class LogAnalyticsOperationResult(OperationStatusResponse): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.properties = None + self.properties: Optional["_models.LogAnalyticsOutput"] = None class LogAnalyticsOutput(_serialization.Model): @@ -1882,7 +1877,7 @@ class LogAnalyticsOutput(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.output = None + self.output: Optional[str] = None class MaintenanceRedeployStatus(_serialization.Model): @@ -2224,7 +2219,7 @@ class OSProfile(_serialization.Model): **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :vartype computer_name: str :ivar admin_username: Specifies the name of the administrator account. :code:`
    `\\ :code:`
    ` **Windows-only restriction:** Cannot end in "." :code:`
    `\\ :code:`
    ` @@ -2236,10 +2231,10 @@ class OSProfile(_serialization.Model): :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -2252,16 +2247,16 @@ class OSProfile(_serialization.Model): "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :vartype admin_password: str :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :vartype custom_data: str :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -2269,10 +2264,10 @@ class OSProfile(_serialization.Model): :ivar linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :vartype linux_configuration: ~azure.mgmt.compute.v2017_12_01.models.LinuxConfiguration :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. :vartype secrets: list[~azure.mgmt.compute.v2017_12_01.models.VaultSecretGroup] @@ -2306,7 +2301,7 @@ def __init__( **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :paramtype computer_name: str :keyword admin_username: Specifies the name of the administrator account. :code:`
    `\\ :code:`
    ` **Windows-only restriction:** Cannot end in "." :code:`
    `\\ :code:`
    ` @@ -2318,10 +2313,10 @@ def __init__( :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -2334,16 +2329,16 @@ def __init__( "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :paramtype admin_password: str :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :paramtype custom_data: str :keyword windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -2351,10 +2346,10 @@ def __init__( :keyword linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :paramtype linux_configuration: ~azure.mgmt.compute.v2017_12_01.models.LinuxConfiguration :keyword secrets: Specifies set of certificates that should be installed onto the virtual machine. @@ -2489,8 +2484,8 @@ class RecoveryWalkResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.walk_performed = None - self.next_platform_update_domain = None + self.walk_performed: Optional[bool] = None + self.next_platform_update_domain: Optional[int] = None class RequestRateByIntervalInput(LogAnalyticsInputBase): @@ -2604,9 +2599,9 @@ class RollbackStatusInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successfully_rolledback_instance_count = None - self.failed_rolledback_instance_count = None - self.rollback_error = None + self.successfully_rolledback_instance_count: Optional[int] = None + self.failed_rolledback_instance_count: Optional[int] = None + self.rollback_error: Optional["_models.ApiError"] = None class RollingUpgradePolicy(_serialization.Model): @@ -2718,10 +2713,10 @@ class RollingUpgradeProgressInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successful_instance_count = None - self.failed_instance_count = None - self.in_progress_instance_count = None - self.pending_instance_count = None + self.successful_instance_count: Optional[int] = None + self.failed_instance_count: Optional[int] = None + self.in_progress_instance_count: Optional[int] = None + self.pending_instance_count: Optional[int] = None class RollingUpgradeRunningStatus(_serialization.Model): @@ -2758,10 +2753,10 @@ class RollingUpgradeRunningStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.last_action = None - self.last_action_time = None + self.code: Optional[Union[str, "_models.RollingUpgradeStatusCode"]] = None + self.start_time: Optional[datetime.datetime] = None + self.last_action: Optional[Union[str, "_models.RollingUpgradeActionType"]] = None + self.last_action_time: Optional[datetime.datetime] = None class RollingUpgradeStatusInfo(Resource): @@ -2823,10 +2818,10 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(location=location, tags=tags, **kwargs) - self.policy = None - self.running_status = None - self.progress = None - self.error = None + self.policy: Optional["_models.RollingUpgradePolicy"] = None + self.running_status: Optional["_models.RollingUpgradeRunningStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None class RunCommandDocumentBase(_serialization.Model): @@ -3245,7 +3240,7 @@ class SshPublicKey(_serialization.Model): :ivar key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `\\ :code:`
    ` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. # pylint: disable=line-too-long + `_. :vartype key_data: str """ @@ -3263,7 +3258,7 @@ def __init__(self, *, path: Optional[str] = None, key_data: Optional[str] = None :keyword key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `\\ :code:`
    ` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. # pylint: disable=line-too-long + `_. :paramtype key_data: str """ super().__init__(**kwargs) @@ -3282,12 +3277,12 @@ class StorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2017_12_01.models.OSDisk :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2017_12_01.models.DataDisk] """ @@ -3314,12 +3309,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2017_12_01.models.OSDisk :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2017_12_01.models.DataDisk] """ super().__init__(**kwargs) @@ -3348,7 +3343,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class ThrottledRequestsInput(LogAnalyticsInputBase): @@ -3401,9 +3396,9 @@ class UpgradeOperationHistoricalStatusInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.properties = None - self.type = None - self.location = None + self.properties: Optional["_models.UpgradeOperationHistoricalStatusInfoProperties"] = None + self.type: Optional[str] = None + self.location: Optional[str] = None class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # pylint: disable=name-too-long @@ -3447,12 +3442,12 @@ class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # p def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.running_status = None - self.progress = None - self.error = None - self.started_by = None - self.target_image_reference = None - self.rollback_info = None + self.running_status: Optional["_models.UpgradeOperationHistoryStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None + self.started_by: Optional[Union[str, "_models.UpgradeOperationInvoker"]] = None + self.target_image_reference: Optional["_models.ImageReference"] = None + self.rollback_info: Optional["_models.RollbackStatusInfo"] = None class UpgradeOperationHistoryStatus(_serialization.Model): @@ -3484,9 +3479,9 @@ class UpgradeOperationHistoryStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.end_time = None + self.code: Optional[Union[str, "_models.UpgradeState"]] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None class UpgradePolicy(_serialization.Model): @@ -3777,10 +3772,10 @@ class VirtualMachine(Resource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :vartype availability_set: ~azure.mgmt.compute.v2017_12_01.models.SubResource @@ -3795,7 +3790,7 @@ class VirtualMachine(Resource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar vm_id: Specifies the VM unique ID which is a 128-bits identifier that is encoded and @@ -3883,10 +3878,10 @@ def __init__( machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :paramtype availability_set: ~azure.mgmt.compute.v2017_12_01.models.SubResource @@ -3897,13 +3892,13 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str """ super().__init__(location=location, tags=tags, **kwargs) self.plan = plan - self.resources = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None self.identity = identity self.zones = zones self.hardware_profile = hardware_profile @@ -3912,10 +3907,10 @@ def __init__( self.network_profile = network_profile self.diagnostics_profile = diagnostics_profile self.availability_set = availability_set - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None class VirtualMachineAgentInstanceView(_serialization.Model): @@ -4153,7 +4148,7 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.instance_view = instance_view @@ -4461,7 +4456,7 @@ class VirtualMachineHealthStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None + self.status: Optional["_models.InstanceViewStatus"] = None class VirtualMachineIdentity(_serialization.Model): @@ -4482,7 +4477,7 @@ class VirtualMachineIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.compute.v2017_12_01.models.ResourceIdentityType :ivar identity_ids: The list of user identities associated with the Virtual Machine. The user identity references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. :vartype identity_ids: list[str] """ @@ -4513,12 +4508,12 @@ def __init__( :paramtype type: str or ~azure.mgmt.compute.v2017_12_01.models.ResourceIdentityType :keyword identity_ids: The list of user identities associated with the Virtual Machine. The user identity references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. :paramtype identity_ids: list[str] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.identity_ids = identity_ids @@ -4945,9 +4940,9 @@ def __init__( self.zones = zones self.upgrade_policy = upgrade_policy self.virtual_machine_profile = virtual_machine_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.overprovision = overprovision - self.unique_id = None + self.unique_id: Optional[str] = None self.single_placement_group = single_placement_group self.zone_balance = zone_balance self.platform_fault_domain_count = platform_fault_domain_count @@ -5142,7 +5137,7 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class VirtualMachineScaleSetExtensionListResult(_serialization.Model): # pylint: disable=name-too-long @@ -5224,7 +5219,7 @@ class VirtualMachineScaleSetIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.compute.v2017_12_01.models.ResourceIdentityType :ivar identity_ids: The list of user identities associated with the virtual machine scale set. The user identity references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. :vartype identity_ids: list[str] """ @@ -5256,12 +5251,12 @@ def __init__( :paramtype type: str or ~azure.mgmt.compute.v2017_12_01.models.ResourceIdentityType :keyword identity_ids: The list of user identities associated with the virtual machine scale set. The user identity references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'. :paramtype identity_ids: list[str] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.identity_ids = identity_ids @@ -5298,8 +5293,8 @@ def __init__(self, *, statuses: Optional[List["_models.InstanceViewStatus"]] = N :paramtype statuses: list[~azure.mgmt.compute.v2017_12_01.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.virtual_machine = None - self.extensions = None + self.virtual_machine: Optional["_models.VirtualMachineScaleSetInstanceViewStatusesSummary"] = None + self.extensions: Optional[List["_models.VirtualMachineScaleSetVMExtensionsSummary"]] = None self.statuses = statuses @@ -5324,7 +5319,7 @@ class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.statuses_summary = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetIPConfiguration(SubResource): @@ -5741,7 +5736,7 @@ class VirtualMachineScaleSetNetworkProfile(_serialization.Model): :ivar health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :vartype health_probe: ~azure.mgmt.compute.v2017_12_01.models.ApiEntityReference :ivar network_interface_configurations: The list of network configurations. :vartype network_interface_configurations: @@ -5766,7 +5761,7 @@ def __init__( """ :keyword health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :paramtype health_probe: ~azure.mgmt.compute.v2017_12_01.models.ApiEntityReference :keyword network_interface_configurations: The list of network configurations. :paramtype network_interface_configurations: @@ -5903,10 +5898,10 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -5919,16 +5914,16 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :vartype admin_password: str :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :vartype custom_data: str :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -5936,10 +5931,10 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): :ivar linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :vartype linux_configuration: ~azure.mgmt.compute.v2017_12_01.models.LinuxConfiguration :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines in the scale set. @@ -5982,10 +5977,10 @@ def __init__( :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -5998,16 +5993,16 @@ def __init__( "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :paramtype admin_password: str :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :paramtype custom_data: str :keyword windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -6015,10 +6010,10 @@ def __init__( :keyword linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :paramtype linux_configuration: ~azure.mgmt.compute.v2017_12_01.models.LinuxConfiguration :keyword secrets: Specifies set of certificates that should be installed onto the virtual machines in the scale set. @@ -6144,9 +6139,9 @@ class VirtualMachineScaleSetSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.resource_type = None - self.sku = None - self.capacity = None + self.resource_type: Optional[str] = None + self.sku: Optional["_models.Sku"] = None + self.capacity: Optional["_models.VirtualMachineScaleSetSkuCapacity"] = None class VirtualMachineScaleSetSkuCapacity(_serialization.Model): @@ -6183,10 +6178,10 @@ class VirtualMachineScaleSetSkuCapacity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default_capacity = None - self.scale_type = None + self.minimum: Optional[int] = None + self.maximum: Optional[int] = None + self.default_capacity: Optional[int] = None + self.scale_type: Optional[Union[str, "_models.VirtualMachineScaleSetSkuScaleType"]] = None class VirtualMachineScaleSetStorageProfile(_serialization.Model): @@ -6200,12 +6195,12 @@ class VirtualMachineScaleSetStorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetOSDisk :ivar data_disks: Specifies the parameters that are used to add data disks to the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetDataDisk] """ @@ -6233,12 +6228,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetOSDisk :keyword data_disks: Specifies the parameters that are used to add data disks to the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetDataDisk] """ @@ -6869,10 +6864,10 @@ class VirtualMachineScaleSetVM(Resource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :vartype availability_set: ~azure.mgmt.compute.v2017_12_01.models.SubResource @@ -6885,7 +6880,7 @@ class VirtualMachineScaleSetVM(Resource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str """ @@ -6968,10 +6963,10 @@ def __init__( machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :paramtype availability_set: ~azure.mgmt.compute.v2017_12_01.models.SubResource @@ -6982,25 +6977,25 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str """ super().__init__(location=location, tags=tags, **kwargs) - self.instance_id = None - self.sku = None + self.instance_id: Optional[str] = None + self.sku: Optional["_models.Sku"] = None self.plan = plan - self.resources = None - self.latest_model_applied = None - self.vm_id = None - self.instance_view = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None + self.latest_model_applied: Optional[bool] = None + self.vm_id: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineScaleSetVMInstanceView"] = None self.hardware_profile = hardware_profile self.storage_profile = storage_profile self.os_profile = os_profile self.network_profile = network_profile self.diagnostics_profile = diagnostics_profile self.availability_set = availability_set - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.license_type = license_type @@ -7029,8 +7024,8 @@ class VirtualMachineScaleSetVMExtensionsSummary(_serialization.Model): # pylint def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.statuses_summary = None + self.name: Optional[str] = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetVMInstanceIDs(_serialization.Model): @@ -7187,7 +7182,7 @@ def __init__( self.maintenance_redeploy_status = maintenance_redeploy_status self.disks = disks self.extensions = extensions - self.vm_health = None + self.vm_health: Optional["_models.VirtualMachineHealthStatus"] = None self.boot_diagnostics = boot_diagnostics self.statuses = statuses self.placement_group_id = placement_group_id @@ -7256,7 +7251,7 @@ class VirtualMachineScaleSetVMProfile(_serialization.Model): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar priority: Specifies the priority for the virtual machines in the scale set. @@ -7319,7 +7314,7 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str :keyword priority: Specifies the priority for the virtual machines in the scale set. @@ -7451,8 +7446,8 @@ class VirtualMachineStatusCodeCount(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.count = None + self.code: Optional[str] = None + self.count: Optional[int] = None class VirtualMachineUpdate(UpdateResource): @@ -7487,10 +7482,10 @@ class VirtualMachineUpdate(UpdateResource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :vartype availability_set: ~azure.mgmt.compute.v2017_12_01.models.SubResource @@ -7505,7 +7500,7 @@ class VirtualMachineUpdate(UpdateResource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar vm_id: Specifies the VM unique ID which is a 128-bits identifier that is encoded and @@ -7580,10 +7575,10 @@ def __init__( machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :paramtype availability_set: ~azure.mgmt.compute.v2017_12_01.models.SubResource @@ -7594,7 +7589,7 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str """ @@ -7608,10 +7603,10 @@ def __init__( self.network_profile = network_profile self.diagnostics_profile = diagnostics_profile self.availability_set = availability_set - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None class WindowsConfiguration(_serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py index 5f410053689c..03af06f85bbe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +75,7 @@ def build_availability_sets_create_or_update_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -111,7 +109,7 @@ def build_availability_sets_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -144,7 +142,7 @@ def build_availability_sets_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -175,7 +173,7 @@ def build_availability_sets_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -232,7 +230,7 @@ def build_availability_sets_list_request(resource_group_name: str, subscription_ _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -262,7 +260,7 @@ def build_availability_sets_list_available_sizes_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -293,7 +291,7 @@ def build_virtual_machine_extension_images_get_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -326,7 +324,7 @@ def build_virtual_machine_extension_images_list_types_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -365,7 +363,7 @@ def build_virtual_machine_extension_images_list_versions_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -404,7 +402,7 @@ def build_virtual_machine_extensions_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -439,7 +437,7 @@ def build_virtual_machine_extensions_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -473,7 +471,7 @@ def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -511,7 +509,7 @@ def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -545,7 +543,7 @@ def build_virtual_machines_get_extensions_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -578,7 +576,7 @@ def build_virtual_machines_list_by_location_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -609,7 +607,7 @@ def build_virtual_machines_capture_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -643,7 +641,7 @@ def build_virtual_machines_create_or_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -677,7 +675,7 @@ def build_virtual_machines_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -710,7 +708,7 @@ def build_virtual_machines_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -746,7 +744,7 @@ def build_virtual_machines_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -779,7 +777,7 @@ def build_virtual_machines_instance_view_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -810,7 +808,7 @@ def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -841,7 +839,7 @@ def build_virtual_machines_deallocate_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -872,7 +870,7 @@ def build_virtual_machines_generalize_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -901,7 +899,7 @@ def build_virtual_machines_list_request(resource_group_name: str, subscription_i _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -955,7 +953,7 @@ def build_virtual_machines_list_available_sizes_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -986,7 +984,7 @@ def build_virtual_machines_power_off_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1017,7 +1015,7 @@ def build_virtual_machines_restart_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1048,7 +1046,7 @@ def build_virtual_machines_start_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1079,7 +1077,7 @@ def build_virtual_machines_redeploy_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1110,7 +1108,7 @@ def build_virtual_machines_perform_maintenance_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1142,7 +1140,7 @@ def build_virtual_machines_run_command_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1175,7 +1173,7 @@ def build_virtual_machine_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1218,7 +1216,7 @@ def build_virtual_machine_images_list_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1257,7 +1255,7 @@ def build_virtual_machine_images_list_offers_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1287,7 +1285,7 @@ def build_virtual_machine_images_list_publishers_request( # pylint: disable=nam # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1317,7 +1315,7 @@ def build_virtual_machine_images_list_skus_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1346,7 +1344,7 @@ def build_usage_list_request(location: str, subscription_id: str, **kwargs: Any) # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1373,7 +1371,7 @@ def build_virtual_machine_sizes_list_request(location: str, subscription_id: str # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1404,7 +1402,7 @@ def build_images_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -1438,7 +1436,7 @@ def build_images_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -1471,7 +1469,7 @@ def build_images_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -1502,7 +1500,7 @@ def build_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -1535,7 +1533,7 @@ def build_images_list_by_resource_group_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1590,7 +1588,7 @@ def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1624,7 +1622,7 @@ def build_virtual_machine_scale_sets_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1657,7 +1655,7 @@ def build_virtual_machine_scale_sets_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1688,7 +1686,7 @@ def build_virtual_machine_scale_sets_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1720,7 +1718,7 @@ def build_virtual_machine_scale_sets_deallocate_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1754,7 +1752,7 @@ def build_virtual_machine_scale_sets_delete_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1787,7 +1785,7 @@ def build_virtual_machine_scale_sets_get_instance_view_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1818,7 +1816,7 @@ def build_virtual_machine_scale_sets_list_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1876,7 +1874,7 @@ def build_virtual_machine_scale_sets_list_skus_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1907,7 +1905,7 @@ def build_virtual_machine_scale_sets_get_os_upgrade_history_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1939,7 +1937,7 @@ def build_virtual_machine_scale_sets_power_off_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -1973,7 +1971,7 @@ def build_virtual_machine_scale_sets_restart_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2007,7 +2005,7 @@ def build_virtual_machine_scale_sets_start_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2041,7 +2039,7 @@ def build_virtual_machine_scale_sets_redeploy_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2075,7 +2073,7 @@ def build_virtual_machine_scale_sets_perform_maintenance_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2109,7 +2107,7 @@ def build_virtual_machine_scale_sets_update_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2143,7 +2141,7 @@ def build_virtual_machine_scale_sets_reimage_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2177,7 +2175,7 @@ def build_virtual_machine_scale_sets_reimage_all_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2215,7 +2213,7 @@ def build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_upda _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2248,7 +2246,7 @@ def build_virtual_machine_scale_set_extensions_create_or_update_request( # pyli _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2282,7 +2280,7 @@ def build_virtual_machine_scale_set_extensions_delete_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2320,7 +2318,7 @@ def build_virtual_machine_scale_set_extensions_get_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2354,7 +2352,7 @@ def build_virtual_machine_scale_set_extensions_list_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2385,7 +2383,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_cancel_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2416,7 +2414,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2447,7 +2445,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( # pyli _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2478,7 +2476,7 @@ def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2510,7 +2508,7 @@ def build_virtual_machine_scale_set_vms_reimage_all_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2542,7 +2540,7 @@ def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2575,7 +2573,7 @@ def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2609,7 +2607,7 @@ def build_virtual_machine_scale_set_vms_delete_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2641,7 +2639,7 @@ def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2673,7 +2671,7 @@ def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2712,7 +2710,7 @@ def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "virtualMachineScaleSetName": _SERIALIZER.url( @@ -2751,7 +2749,7 @@ def build_virtual_machine_scale_set_vms_power_off_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2783,7 +2781,7 @@ def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2815,7 +2813,7 @@ def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2847,7 +2845,7 @@ def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2879,7 +2877,7 @@ def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2912,7 +2910,7 @@ def build_log_analytics_export_request_rate_by_interval_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2945,7 +2943,7 @@ def build_log_analytics_export_throttled_requests_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2976,7 +2974,7 @@ def build_virtual_machine_run_commands_list_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -3006,7 +3004,7 @@ def build_virtual_machine_run_commands_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "commandId": _SERIALIZER.url("command_id", command_id, "str"), @@ -3038,10 +3036,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3134,10 +3132,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -3761,10 +3759,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3976,10 +3974,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -4601,10 +4599,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6815,10 +6813,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7148,10 +7146,10 @@ class UsageOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7247,10 +7245,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7345,10 +7343,10 @@ class ImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -8049,10 +8047,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -11091,10 +11089,10 @@ class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -11590,10 +11588,10 @@ class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-t def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -11891,10 +11889,10 @@ class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-me def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _reimage_initial( @@ -13391,10 +13389,10 @@ class LogAnalyticsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _export_request_rate_by_interval_initial( @@ -13763,10 +13761,10 @@ class VirtualMachineRunCommandsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_compute_management_client.py index d4ca74ee6d8e..c22923d128ed 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -34,7 +36,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-04-01". Note that overriding this default value may result in unsupported behavior. @@ -42,15 +44,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -69,7 +73,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_metadata.json index 68c7c0d7b00e..35adb8dfd110 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_compute_management_client.py index 1b38605de5e9..158719a1d075 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -34,7 +36,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-04-01". Note that overriding this default value may result in unsupported behavior. @@ -42,15 +44,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -69,7 +73,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/operations/_operations.py index bd01f2163fa4..c843f08a9b7d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/operations/_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import build_resource_skus_list_request +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -49,10 +48,10 @@ class ResourceSkusOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_models_py3.py index d6643aa6d671..b31fd9a30466 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/_models_py3.py @@ -86,19 +86,19 @@ class ResourceSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.resource_type = None - self.name = None - self.tier = None - self.size = None - self.family = None - self.kind = None - self.capacity = None - self.locations = None - self.location_info = None - self.api_versions = None - self.costs = None - self.capabilities = None - self.restrictions = None + self.resource_type: Optional[str] = None + self.name: Optional[str] = None + self.tier: Optional[str] = None + self.size: Optional[str] = None + self.family: Optional[str] = None + self.kind: Optional[str] = None + self.capacity: Optional["_models.ResourceSkuCapacity"] = None + self.locations: Optional[List[str]] = None + self.location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None + self.api_versions: Optional[List[str]] = None + self.costs: Optional[List["_models.ResourceSkuCosts"]] = None + self.capabilities: Optional[List["_models.ResourceSkuCapabilities"]] = None + self.restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None class ResourceSkuCapabilities(_serialization.Model): @@ -125,8 +125,8 @@ class ResourceSkuCapabilities(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.value = None + self.name: Optional[str] = None + self.value: Optional[str] = None class ResourceSkuCapacity(_serialization.Model): @@ -162,10 +162,10 @@ class ResourceSkuCapacity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default = None - self.scale_type = None + self.minimum: Optional[int] = None + self.maximum: Optional[int] = None + self.default: Optional[int] = None + self.scale_type: Optional[Union[str, "_models.ResourceSkuCapacityScaleType"]] = None class ResourceSkuCosts(_serialization.Model): @@ -196,9 +196,9 @@ class ResourceSkuCosts(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None + self.meter_id: Optional[str] = None + self.quantity: Optional[int] = None + self.extended_unit: Optional[str] = None class ResourceSkuLocationInfo(_serialization.Model): @@ -229,9 +229,9 @@ class ResourceSkuLocationInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.location = None - self.zones = None - self.zone_details = None + self.location: Optional[str] = None + self.zones: Optional[List[str]] = None + self.zone_details: Optional[List["_models.ResourceSkuZoneDetails"]] = None class ResourceSkuRestrictionInfo(_serialization.Model): @@ -258,8 +258,8 @@ class ResourceSkuRestrictionInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.locations = None - self.zones = None + self.locations: Optional[List[str]] = None + self.zones: Optional[List[str]] = None class ResourceSkuRestrictions(_serialization.Model): @@ -297,10 +297,10 @@ class ResourceSkuRestrictions(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.values = None - self.restriction_info = None - self.reason_code = None + self.type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None + self.values: Optional[List[str]] = None + self.restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None + self.reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None class ResourceSkusResult(_serialization.Model): @@ -362,5 +362,5 @@ class ResourceSkuZoneDetails(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.capabilities = None + self.name: Optional[List[str]] = None + self.capabilities: Optional[List["_models.ResourceSkuCapabilities"]] = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_operations.py index ec2f1dff90bb..9b7d803b7dc1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -80,10 +78,10 @@ class ResourceSkusOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_compute_management_client.py index aa1b57cf537d..086164431c39 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -134,7 +136,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-07-01". Note that overriding this default value may result in unsupported behavior. @@ -144,15 +146,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -171,7 +175,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_metadata.json index 4fc95c06a995..d9ef72e7b030 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_compute_management_client.py index 7ddcdb37c384..106f4cb392a2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -136,7 +138,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-07-01". Note that overriding this default value may result in unsupported behavior. @@ -146,15 +148,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -173,7 +177,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py index f50f186d013f..4f7c7ae0d3b3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import ( Any, AsyncIterable, @@ -25,6 +25,7 @@ ) import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -46,6 +47,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_availability_sets_create_or_update_request, build_availability_sets_delete_request, @@ -216,11 +218,8 @@ build_virtual_machines_start_request, build_virtual_machines_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -239,10 +238,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -335,10 +334,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -957,10 +956,10 @@ class ProximityPlacementGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -1509,10 +1508,10 @@ class DedicatedHostGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2051,10 +2050,10 @@ class DedicatedHostsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2741,10 +2740,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -2956,10 +2955,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -3634,10 +3633,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3967,10 +3966,10 @@ class UsageOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4066,10 +4065,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6474,10 +6473,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6574,10 +6573,10 @@ class ImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -7270,10 +7269,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -8504,7 +8503,6 @@ async def get_next(next_link=None): def get_os_upgrade_history( self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncIterable["_models.UpgradeOperationHistoricalStatusInfo"]: - # pylint: disable=line-too-long """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. Required. @@ -10344,10 +10342,10 @@ class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -11049,10 +11047,10 @@ class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-t def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _cancel_initial( @@ -11442,10 +11440,10 @@ class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too- def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -12154,10 +12152,10 @@ class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-me def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _reimage_initial( @@ -13917,10 +13915,10 @@ class LogAnalyticsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _export_request_rate_by_interval_initial( @@ -14291,10 +14289,10 @@ class DisksOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -15296,10 +15294,10 @@ class SnapshotsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -16321,10 +16319,10 @@ class DiskEncryptionSetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -17064,10 +17062,10 @@ class GalleriesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -17774,10 +17772,10 @@ class GalleryImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -18470,10 +18468,10 @@ class GalleryImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -19248,10 +19246,10 @@ class GalleryApplicationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -19956,10 +19954,10 @@ class GalleryApplicationVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -20739,10 +20737,10 @@ class VirtualMachineRunCommandsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_compute_management_client_enums.py index 6afc2393f3d8..683e67caf434 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_compute_management_client_enums.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models_py3.py index d4a937f82ff2..c7ab32d608f1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AccessUri(_serialization.Model): @@ -43,7 +38,7 @@ class AccessUri(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.access_sas = None + self.access_sas: Optional[str] = None class AdditionalCapabilities(_serialization.Model): @@ -248,7 +243,7 @@ class AutomaticOSUpgradePolicy(_serialization.Model): applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. :code:`
    `\\ :code:`
    ` If this is set to true for Windows based scale sets, `enableAutomaticUpdates - `_ # pylint: disable=line-too-long + `_ is automatically set to false and cannot be set to true. :vartype enable_automatic_os_upgrade: bool :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default @@ -273,7 +268,7 @@ def __init__( applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. :code:`
    `\\ :code:`
    ` If this is set to true for Windows based scale sets, `enableAutomaticUpdates - `_ # pylint: disable=line-too-long + `_ is automatically set to false and cannot be set to true. :paramtype enable_automatic_os_upgrade: bool :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. @@ -391,9 +386,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -505,7 +500,7 @@ def __init__( self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines self.proximity_placement_group = proximity_placement_group - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None class AvailabilitySetListResult(_serialization.Model): @@ -636,7 +631,7 @@ def __init__( self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines self.proximity_placement_group = proximity_placement_group - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None class BillingProfile(_serialization.Model): @@ -742,9 +737,9 @@ class BootDiagnosticsInstanceView(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None - self.status = None + self.console_screenshot_blob_uri: Optional[str] = None + self.serial_console_log_blob_uri: Optional[str] = None + self.status: Optional["_models.InstanceViewStatus"] = None class ComputeOperationListResult(_serialization.Model): @@ -767,7 +762,7 @@ class ComputeOperationListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None + self.value: Optional[List["_models.ComputeOperationValue"]] = None class ComputeOperationValue(_serialization.Model): @@ -810,12 +805,12 @@ class ComputeOperationValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.origin = None - self.name = None - self.operation = None - self.resource = None - self.description = None - self.provider = None + self.origin: Optional[str] = None + self.name: Optional[str] = None + self.operation: Optional[str] = None + self.resource: Optional[str] = None + self.description: Optional[str] = None + self.provider: Optional[str] = None class CreationData(_serialization.Model): @@ -902,7 +897,7 @@ def __init__( self.image_reference = image_reference self.source_uri = source_uri self.source_resource_id = source_resource_id - self.source_unique_id = None + self.source_unique_id: Optional[str] = None self.upload_size_bytes = upload_size_bytes @@ -1049,8 +1044,8 @@ def __init__( self.disk_size_gb = disk_size_gb self.managed_disk = managed_disk self.to_be_detached = to_be_detached - self.disk_iops_read_write = None - self.disk_m_bps_read_write = None + self.disk_iops_read_write: Optional[int] = None + self.disk_m_bps_read_write: Optional[int] = None class DataDiskImage(_serialization.Model): @@ -1074,7 +1069,7 @@ class DataDiskImage(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.lun = None + self.lun: Optional[int] = None class DedicatedHost(Resource): @@ -1189,12 +1184,12 @@ def __init__( self.sku = sku self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure - self.host_id = None - self.virtual_machines = None + self.host_id: Optional[str] = None + self.virtual_machines: Optional[List["_models.SubResourceReadOnly"]] = None self.license_type = license_type - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.DedicatedHostInstanceView"] = None class DedicatedHostAllocatableVM(_serialization.Model): @@ -1325,7 +1320,7 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count - self.hosts = None + self.hosts: Optional[List["_models.SubResourceReadOnly"]] = None class DedicatedHostGroupListResult(_serialization.Model): @@ -1415,7 +1410,7 @@ def __init__( super().__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count - self.hosts = None + self.hosts: Optional[List["_models.SubResourceReadOnly"]] = None class DedicatedHostInstanceView(_serialization.Model): @@ -1458,7 +1453,7 @@ def __init__( :paramtype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.asset_id = None + self.asset_id: Optional[str] = None self.available_capacity = available_capacity self.statuses = statuses @@ -1579,12 +1574,12 @@ def __init__( super().__init__(tags=tags, **kwargs) self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure - self.host_id = None - self.virtual_machines = None + self.host_id: Optional[str] = None + self.virtual_machines: Optional[List["_models.SubResourceReadOnly"]] = None self.license_type = license_type - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.DedicatedHostInstanceView"] = None class DiagnosticsProfile(_serialization.Model): @@ -1816,21 +1811,21 @@ def __init__( :paramtype encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption """ super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None + self.managed_by: Optional[str] = None self.sku = sku self.zones = zones - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.hyper_v_generation = hyper_v_generation self.creation_data = creation_data self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.unique_id = None + self.disk_size_bytes: Optional[int] = None + self.unique_id: Optional[str] = None self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.disk_iops_read_write = disk_iops_read_write self.disk_m_bps_read_write = disk_m_bps_read_write - self.disk_state = None + self.disk_state: Optional[Union[str, "_models.DiskState"]] = None self.encryption = encryption @@ -1908,8 +1903,8 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.identity = identity self.active_key = active_key - self.previous_keys = None - self.provisioning_state = None + self.previous_keys: Optional[List["_models.KeyVaultAndKeyReference"]] = None + self.provisioning_state: Optional[str] = None class DiskEncryptionSetList(_serialization.Model): @@ -2160,7 +2155,7 @@ def __init__(self, *, name: Optional[Union[str, "_models.DiskStorageAccountTypes """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class DiskUpdate(_serialization.Model): @@ -2338,8 +2333,8 @@ def __init__( """ super().__init__(**kwargs) self.type = type - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None class EncryptionSettingsCollection(_serialization.Model): @@ -2504,7 +2499,7 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.description = description self.identifier = identifier - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryPropertiesProvisioningState"]] = None class GalleryApplication(Resource): @@ -2795,8 +2790,10 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None - self.replication_status = None + self.provisioning_state: Optional[ + Union[str, "_models.GalleryApplicationVersionPropertiesProvisioningState"] + ] = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryApplicationVersionList(_serialization.Model): @@ -2906,7 +2903,7 @@ def __init__( self.target_regions = target_regions self.replica_count = replica_count self.exclude_from_latest = exclude_from_latest - self.published_date = None + self.published_date: Optional[datetime.datetime] = None self.end_of_life_date = end_of_life_date self.storage_account_type = storage_account_type @@ -3062,8 +3059,10 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None - self.replication_status = None + self.provisioning_state: Optional[ + Union[str, "_models.GalleryApplicationVersionPropertiesProvisioningState"] + ] = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryArtifactSource(_serialization.Model): @@ -3153,7 +3152,7 @@ def __init__( :paramtype source: ~azure.mgmt.compute.v2019_07_01.models.GalleryArtifactVersionSource """ super().__init__(**kwargs) - self.size_in_gb = None + self.size_in_gb: Optional[int] = None self.host_caching = host_caching self.source = source @@ -3234,7 +3233,7 @@ class GalleryIdentifier(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.unique_name = None + self.unique_name: Optional[str] = None class GalleryImage(Resource): @@ -3395,7 +3394,7 @@ def __init__( self.recommended = recommended self.disallowed = disallowed self.purchase_plan = purchase_plan - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImagePropertiesProvisioningState"]] = None class GalleryImageIdentifier(_serialization.Model): @@ -3609,7 +3608,7 @@ def __init__( self.recommended = recommended self.disallowed = disallowed self.purchase_plan = purchase_plan - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImagePropertiesProvisioningState"]] = None class GalleryImageVersion(Resource): @@ -3687,9 +3686,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImageVersionPropertiesProvisioningState"]] = None self.storage_profile = storage_profile - self.replication_status = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryImageVersionList(_serialization.Model): @@ -3847,9 +3846,9 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImageVersionPropertiesProvisioningState"]] = None self.storage_profile = storage_profile - self.replication_status = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryList(_serialization.Model): @@ -3950,7 +3949,7 @@ def __init__( super().__init__(tags=tags, **kwargs) self.description = description self.identifier = identifier - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryPropertiesProvisioningState"]] = None class GrantAccessData(_serialization.Model): @@ -3991,7 +3990,7 @@ class HardwareProfile(_serialization.Model): :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: :code:`
    `\\ :code:`
    ` `List all available virtual machine sizes in an availability set @@ -4048,7 +4047,7 @@ def __init__( """ :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: :code:`
    `\\ :code:`
    ` `List all available virtual machine sizes in an availability set @@ -4176,7 +4175,7 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.hyper_v_generation = hyper_v_generation @@ -4681,7 +4680,7 @@ def __init__( self.offer = offer self.sku = sku self.version = version - self.exact_version = None + self.exact_version: Optional[str] = None class ImageStorageProfile(_serialization.Model): @@ -4690,12 +4689,12 @@ class ImageStorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2019_07_01.models.ImageOSDisk :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2019_07_01.models.ImageDataDisk] :ivar zone_resilient: Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). @@ -4720,12 +4719,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2019_07_01.models.ImageOSDisk :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2019_07_01.models.ImageDataDisk] :keyword zone_resilient: Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). @@ -4792,7 +4791,7 @@ def __init__( super().__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.hyper_v_generation = hyper_v_generation @@ -5187,7 +5186,7 @@ class LogAnalyticsOperationResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.properties = None + self.properties: Optional["_models.LogAnalyticsOutput"] = None class LogAnalyticsOutput(_serialization.Model): @@ -5210,7 +5209,7 @@ class LogAnalyticsOutput(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.output = None + self.output: Optional[str] = None class MaintenanceRedeployStatus(_serialization.Model): @@ -5600,7 +5599,7 @@ class OSProfile(_serialization.Model): **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :vartype computer_name: str :ivar admin_username: Specifies the name of the administrator account. :code:`
    `\\ :code:`
    ` This property cannot be updated after the VM is created. :code:`
    `\\ @@ -5613,10 +5612,10 @@ class OSProfile(_serialization.Model): :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -5629,10 +5628,10 @@ class OSProfile(_serialization.Model): "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :vartype admin_password: str :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum @@ -5643,7 +5642,7 @@ class OSProfile(_serialization.Model): `_ :code:`
    `\\ :code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :vartype custom_data: str :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -5651,10 +5650,10 @@ class OSProfile(_serialization.Model): :ivar linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :vartype linux_configuration: ~azure.mgmt.compute.v2019_07_01.models.LinuxConfiguration :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. :vartype secrets: list[~azure.mgmt.compute.v2019_07_01.models.VaultSecretGroup] @@ -5699,7 +5698,7 @@ def __init__( **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :paramtype computer_name: str :keyword admin_username: Specifies the name of the administrator account. :code:`
    `\\ :code:`
    ` This property cannot be updated after the VM is created. :code:`
    `\\ @@ -5712,10 +5711,10 @@ def __init__( :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -5728,10 +5727,10 @@ def __init__( "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :paramtype admin_password: str :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum @@ -5742,7 +5741,7 @@ def __init__( `_ :code:`
    `\\ :code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :paramtype custom_data: str :keyword windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -5750,10 +5749,10 @@ def __init__( :keyword linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :paramtype linux_configuration: ~azure.mgmt.compute.v2019_07_01.models.LinuxConfiguration :keyword secrets: Specifies set of certificates that should be installed onto the virtual machine. @@ -5920,9 +5919,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type - self.virtual_machines = None - self.virtual_machine_scale_sets = None - self.availability_sets = None + self.virtual_machines: Optional[List["_models.SubResourceWithColocationStatus"]] = None + self.virtual_machine_scale_sets: Optional[List["_models.SubResourceWithColocationStatus"]] = None + self.availability_sets: Optional[List["_models.SubResourceWithColocationStatus"]] = None self.colocation_status = colocation_status @@ -6068,8 +6067,8 @@ class RecoveryWalkResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.walk_performed = None - self.next_platform_update_domain = None + self.walk_performed: Optional[bool] = None + self.next_platform_update_domain: Optional[int] = None class RegionalReplicationStatus(_serialization.Model): @@ -6105,10 +6104,10 @@ class RegionalReplicationStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.region = None - self.state = None - self.details = None - self.progress = None + self.region: Optional[str] = None + self.state: Optional[Union[str, "_models.ReplicationState"]] = None + self.details: Optional[str] = None + self.progress: Optional[int] = None class ReplicationStatus(_serialization.Model): @@ -6137,8 +6136,8 @@ class ReplicationStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.aggregated_state = None - self.summary = None + self.aggregated_state: Optional[Union[str, "_models.AggregatedReplicationState"]] = None + self.summary: Optional[List["_models.RegionalReplicationStatus"]] = None class RequestRateByIntervalInput(LogAnalyticsInputBase): @@ -6284,9 +6283,9 @@ class RollbackStatusInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successfully_rolledback_instance_count = None - self.failed_rolledback_instance_count = None - self.rollback_error = None + self.successfully_rolledback_instance_count: Optional[int] = None + self.failed_rolledback_instance_count: Optional[int] = None + self.rollback_error: Optional["_models.ApiError"] = None class RollingUpgradePolicy(_serialization.Model): @@ -6398,10 +6397,10 @@ class RollingUpgradeProgressInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successful_instance_count = None - self.failed_instance_count = None - self.in_progress_instance_count = None - self.pending_instance_count = None + self.successful_instance_count: Optional[int] = None + self.failed_instance_count: Optional[int] = None + self.in_progress_instance_count: Optional[int] = None + self.pending_instance_count: Optional[int] = None class RollingUpgradeRunningStatus(_serialization.Model): @@ -6438,10 +6437,10 @@ class RollingUpgradeRunningStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.last_action = None - self.last_action_time = None + self.code: Optional[Union[str, "_models.RollingUpgradeStatusCode"]] = None + self.start_time: Optional[datetime.datetime] = None + self.last_action: Optional[Union[str, "_models.RollingUpgradeActionType"]] = None + self.last_action_time: Optional[datetime.datetime] = None class RollingUpgradeStatusInfo(Resource): @@ -6503,10 +6502,10 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(location=location, tags=tags, **kwargs) - self.policy = None - self.running_status = None - self.progress = None - self.error = None + self.policy: Optional["_models.RollingUpgradePolicy"] = None + self.running_status: Optional["_models.RollingUpgradeRunningStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None class RunCommandDocumentBase(_serialization.Model): @@ -7085,17 +7084,17 @@ def __init__( :paramtype encryption: ~azure.mgmt.compute.v2019_07_01.models.Encryption """ super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None + self.managed_by: Optional[str] = None self.sku = sku - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.hyper_v_generation = hyper_v_generation self.creation_data = creation_data self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.unique_id = None + self.disk_size_bytes: Optional[int] = None + self.unique_id: Optional[str] = None self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.incremental = incremental self.encryption = encryption @@ -7164,7 +7163,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class SnapshotUpdate(_serialization.Model): @@ -7294,7 +7293,7 @@ class SshPublicKey(_serialization.Model): :ivar key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `\\ :code:`
    ` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. # pylint: disable=line-too-long + `_. :vartype key_data: str """ @@ -7312,7 +7311,7 @@ def __init__(self, *, path: Optional[str] = None, key_data: Optional[str] = None :keyword key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `\\ :code:`
    ` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. # pylint: disable=line-too-long + `_. :paramtype key_data: str """ super().__init__(**kwargs) @@ -7331,12 +7330,12 @@ class StorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2019_07_01.models.OSDisk :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2019_07_01.models.DataDisk] """ @@ -7363,12 +7362,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2019_07_01.models.OSDisk :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2019_07_01.models.DataDisk] """ super().__init__(**kwargs) @@ -7397,7 +7396,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class SubResourceWithColocationStatus(SubResource): @@ -7567,9 +7566,9 @@ class UpgradeOperationHistoricalStatusInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.properties = None - self.type = None - self.location = None + self.properties: Optional["_models.UpgradeOperationHistoricalStatusInfoProperties"] = None + self.type: Optional[str] = None + self.location: Optional[str] = None class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # pylint: disable=name-too-long @@ -7613,12 +7612,12 @@ class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # p def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.running_status = None - self.progress = None - self.error = None - self.started_by = None - self.target_image_reference = None - self.rollback_info = None + self.running_status: Optional["_models.UpgradeOperationHistoryStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None + self.started_by: Optional[Union[str, "_models.UpgradeOperationInvoker"]] = None + self.target_image_reference: Optional["_models.ImageReference"] = None + self.rollback_info: Optional["_models.RollbackStatusInfo"] = None class UpgradeOperationHistoryStatus(_serialization.Model): @@ -7650,9 +7649,9 @@ class UpgradeOperationHistoryStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.end_time = None + self.code: Optional[Union[str, "_models.UpgradeState"]] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None class UpgradePolicy(_serialization.Model): @@ -7892,8 +7891,8 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class VaultCertificate(_serialization.Model): @@ -8051,10 +8050,10 @@ class VirtualMachine(Resource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. @@ -8100,7 +8099,7 @@ class VirtualMachine(Resource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar vm_id: Specifies the VM unique ID which is a 128-bits identifier that is encoded and @@ -8207,10 +8206,10 @@ def __init__( # pylint: disable=too-many-locals machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. @@ -8252,13 +8251,13 @@ def __init__( # pylint: disable=too-many-locals element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str """ super().__init__(location=location, tags=tags, **kwargs) self.plan = plan - self.resources = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None self.identity = identity self.zones = zones self.hardware_profile = hardware_profile @@ -8274,10 +8273,10 @@ def __init__( # pylint: disable=too-many-locals self.eviction_policy = eviction_policy self.billing_profile = billing_profile self.host = host - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None class VirtualMachineAgentInstanceView(_serialization.Model): @@ -8403,10 +8402,10 @@ def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylin :paramtype id: str """ super().__init__(id=id, **kwargs) - self.schema = None - self.content_version = None - self.parameters = None - self.resources = None + self.schema: Optional[str] = None + self.content_version: Optional[str] = None + self.parameters: Optional[JSON] = None + self.resources: Optional[List[JSON]] = None class VirtualMachineExtension(Resource): @@ -8528,7 +8527,7 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.instance_view = instance_view @@ -8836,7 +8835,7 @@ class VirtualMachineHealthStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None + self.status: Optional["_models.InstanceViewStatus"] = None class VirtualMachineIdentity(_serialization.Model): @@ -8857,7 +8856,7 @@ class VirtualMachineIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.compute.v2019_07_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_07_01.models.UserAssignedIdentitiesValue] """ @@ -8889,13 +8888,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.compute.v2019_07_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_07_01.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -9431,10 +9430,10 @@ def __init__( self.upgrade_policy = upgrade_policy self.automatic_repairs_policy = automatic_repairs_policy self.virtual_machine_profile = virtual_machine_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.overprovision = overprovision self.do_not_run_extensions_on_overprovisioned_v_ms = do_not_run_extensions_on_overprovisioned_v_ms - self.unique_id = None + self.unique_id: Optional[str] = None self.single_placement_group = single_placement_group self.zone_balance = zone_balance self.platform_fault_domain_count = platform_fault_domain_count @@ -9661,7 +9660,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.type = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -9669,7 +9668,7 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.provision_after_extensions = provision_after_extensions @@ -9830,8 +9829,8 @@ def __init__( :paramtype provision_after_extensions: list[str] """ super().__init__(**kwargs) - self.name = None - self.type = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -9839,7 +9838,7 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.provision_after_extensions = provision_after_extensions @@ -9862,7 +9861,7 @@ class VirtualMachineScaleSetIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.compute.v2019_07_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -9901,13 +9900,13 @@ def __init__( :keyword user_assigned_identities: The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -9936,8 +9935,8 @@ class VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue(_serialization.M def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class VirtualMachineScaleSetInstanceView(_serialization.Model): @@ -9972,8 +9971,8 @@ def __init__(self, *, statuses: Optional[List["_models.InstanceViewStatus"]] = N :paramtype statuses: list[~azure.mgmt.compute.v2019_07_01.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.virtual_machine = None - self.extensions = None + self.virtual_machine: Optional["_models.VirtualMachineScaleSetInstanceViewStatusesSummary"] = None + self.extensions: Optional[List["_models.VirtualMachineScaleSetVMExtensionsSummary"]] = None self.statuses = statuses @@ -9998,7 +9997,7 @@ class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.statuses_summary = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetIPConfiguration(SubResource): @@ -10467,7 +10466,7 @@ class VirtualMachineScaleSetNetworkProfile(_serialization.Model): :ivar health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :vartype health_probe: ~azure.mgmt.compute.v2019_07_01.models.ApiEntityReference :ivar network_interface_configurations: The list of network configurations. :vartype network_interface_configurations: @@ -10492,7 +10491,7 @@ def __init__( """ :keyword health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :paramtype health_probe: ~azure.mgmt.compute.v2019_07_01.models.ApiEntityReference :keyword network_interface_configurations: The list of network configurations. :paramtype network_interface_configurations: @@ -10649,10 +10648,10 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -10665,16 +10664,16 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :vartype admin_password: str :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :vartype custom_data: str :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -10682,10 +10681,10 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): :ivar linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :vartype linux_configuration: ~azure.mgmt.compute.v2019_07_01.models.LinuxConfiguration :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines in the scale set. @@ -10728,10 +10727,10 @@ def __init__( :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -10744,16 +10743,16 @@ def __init__( "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :paramtype admin_password: str :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :paramtype custom_data: str :keyword windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -10761,10 +10760,10 @@ def __init__( :keyword linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :paramtype linux_configuration: ~azure.mgmt.compute.v2019_07_01.models.LinuxConfiguration :keyword secrets: Specifies set of certificates that should be installed onto the virtual machines in the scale set. @@ -10957,9 +10956,9 @@ class VirtualMachineScaleSetSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.resource_type = None - self.sku = None - self.capacity = None + self.resource_type: Optional[str] = None + self.sku: Optional["_models.Sku"] = None + self.capacity: Optional["_models.VirtualMachineScaleSetSkuCapacity"] = None class VirtualMachineScaleSetSkuCapacity(_serialization.Model): @@ -10996,10 +10995,10 @@ class VirtualMachineScaleSetSkuCapacity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default_capacity = None - self.scale_type = None + self.minimum: Optional[int] = None + self.maximum: Optional[int] = None + self.default_capacity: Optional[int] = None + self.scale_type: Optional[Union[str, "_models.VirtualMachineScaleSetSkuScaleType"]] = None class VirtualMachineScaleSetStorageProfile(_serialization.Model): @@ -11013,12 +11012,12 @@ class VirtualMachineScaleSetStorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetOSDisk :ivar data_disks: Specifies the parameters that are used to add data disks to the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetDataDisk] """ @@ -11046,12 +11045,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetOSDisk :keyword data_disks: Specifies the parameters that are used to add data disks to the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetDataDisk] """ @@ -11409,7 +11408,7 @@ class VirtualMachineScaleSetUpdateNetworkProfile(_serialization.Model): # pylin :ivar health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :vartype health_probe: ~azure.mgmt.compute.v2019_07_01.models.ApiEntityReference :ivar network_interface_configurations: The list of network configurations. :vartype network_interface_configurations: @@ -11436,7 +11435,7 @@ def __init__( """ :keyword health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :paramtype health_probe: ~azure.mgmt.compute.v2019_07_01.models.ApiEntityReference :keyword network_interface_configurations: The list of network configurations. :paramtype network_interface_configurations: @@ -11799,10 +11798,10 @@ class VirtualMachineScaleSetVM(Resource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :vartype availability_set: ~azure.mgmt.compute.v2019_07_01.models.SubResource @@ -11815,7 +11814,7 @@ class VirtualMachineScaleSetVM(Resource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar model_definition_applied: Specifies whether the model applied to the virtual machine is @@ -11926,10 +11925,10 @@ def __init__( # pylint: disable=too-many-locals machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :paramtype availability_set: ~azure.mgmt.compute.v2019_07_01.models.SubResource @@ -11940,7 +11939,7 @@ def __init__( # pylint: disable=too-many-locals element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str :keyword protection_policy: Specifies the protection policy of the virtual machine. @@ -11948,14 +11947,14 @@ def __init__( # pylint: disable=too-many-locals ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMProtectionPolicy """ super().__init__(location=location, tags=tags, **kwargs) - self.instance_id = None - self.sku = None + self.instance_id: Optional[str] = None + self.sku: Optional["_models.Sku"] = None self.plan = plan - self.resources = None - self.zones = None - self.latest_model_applied = None - self.vm_id = None - self.instance_view = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None + self.zones: Optional[List[str]] = None + self.latest_model_applied: Optional[bool] = None + self.vm_id: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineScaleSetVMInstanceView"] = None self.hardware_profile = hardware_profile self.storage_profile = storage_profile self.additional_capabilities = additional_capabilities @@ -11964,9 +11963,9 @@ def __init__( # pylint: disable=too-many-locals self.network_profile_configuration = network_profile_configuration self.diagnostics_profile = diagnostics_profile self.availability_set = availability_set - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.license_type = license_type - self.model_definition_applied = None + self.model_definition_applied: Optional[str] = None self.protection_policy = protection_policy @@ -11995,8 +11994,8 @@ class VirtualMachineScaleSetVMExtensionsSummary(_serialization.Model): # pylint def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.statuses_summary = None + self.name: Optional[str] = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetVMInstanceIDs(_serialization.Model): @@ -12153,7 +12152,7 @@ def __init__( self.maintenance_redeploy_status = maintenance_redeploy_status self.disks = disks self.extensions = extensions - self.vm_health = None + self.vm_health: Optional["_models.VirtualMachineHealthStatus"] = None self.boot_diagnostics = boot_diagnostics self.statuses = statuses self.placement_group_id = placement_group_id @@ -12252,7 +12251,7 @@ class VirtualMachineScaleSetVMProfile(_serialization.Model): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar priority: Specifies the priority for the virtual machines in the scale set. @@ -12327,7 +12326,7 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str :keyword priority: Specifies the priority for the virtual machines in the scale set. @@ -12507,8 +12506,8 @@ class VirtualMachineStatusCodeCount(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.count = None + self.code: Optional[str] = None + self.count: Optional[int] = None class VirtualMachineUpdate(UpdateResource): @@ -12547,10 +12546,10 @@ class VirtualMachineUpdate(UpdateResource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. @@ -12596,7 +12595,7 @@ class VirtualMachineUpdate(UpdateResource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar vm_id: Specifies the VM unique ID which is a 128-bits identifier that is encoded and @@ -12690,10 +12689,10 @@ def __init__( machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. @@ -12735,7 +12734,7 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str """ @@ -12756,10 +12755,10 @@ def __init__( self.eviction_policy = eviction_policy self.billing_profile = billing_profile self.host = host - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None class VMScaleSetConvertToSinglePlacementGroupInput(_serialization.Model): # pylint: disable=name-too-long diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py index 88a9bafa05b9..9933aedac729 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +75,7 @@ def build_availability_sets_create_or_update_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -111,7 +109,7 @@ def build_availability_sets_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -141,7 +139,7 @@ def build_availability_sets_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -169,7 +167,7 @@ def build_availability_sets_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -226,7 +224,7 @@ def build_availability_sets_list_request(resource_group_name: str, subscription_ _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -256,7 +254,7 @@ def build_availability_sets_list_available_sizes_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -288,7 +286,7 @@ def build_proximity_placement_groups_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -324,7 +322,7 @@ def build_proximity_placement_groups_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -356,7 +354,7 @@ def build_proximity_placement_groups_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -391,7 +389,7 @@ def build_proximity_placement_groups_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -456,7 +454,7 @@ def build_proximity_placement_groups_list_by_resource_group_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -487,7 +485,7 @@ def build_dedicated_host_groups_create_or_update_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -521,7 +519,7 @@ def build_dedicated_host_groups_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -551,7 +549,7 @@ def build_dedicated_host_groups_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -579,7 +577,7 @@ def build_dedicated_host_groups_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -610,7 +608,7 @@ def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -667,7 +665,7 @@ def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -702,7 +700,7 @@ def build_dedicated_hosts_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -733,7 +731,7 @@ def build_dedicated_hosts_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -768,7 +766,7 @@ def build_dedicated_hosts_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -802,7 +800,7 @@ def build_dedicated_hosts_list_by_host_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -833,7 +831,7 @@ def build_virtual_machine_extension_images_get_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -866,7 +864,7 @@ def build_virtual_machine_extension_images_list_types_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -905,7 +903,7 @@ def build_virtual_machine_extension_images_list_versions_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -944,7 +942,7 @@ def build_virtual_machine_extensions_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -979,7 +977,7 @@ def build_virtual_machine_extensions_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1010,7 +1008,7 @@ def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1045,7 +1043,7 @@ def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1079,7 +1077,7 @@ def build_virtual_machine_extensions_list_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1112,7 +1110,7 @@ def build_virtual_machine_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1155,7 +1153,7 @@ def build_virtual_machine_images_list_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1194,7 +1192,7 @@ def build_virtual_machine_images_list_offers_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1224,7 +1222,7 @@ def build_virtual_machine_images_list_publishers_request( # pylint: disable=nam # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1254,7 +1252,7 @@ def build_virtual_machine_images_list_skus_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1283,7 +1281,7 @@ def build_usage_list_request(location: str, subscription_id: str, **kwargs: Any) # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1313,7 +1311,7 @@ def build_virtual_machines_list_by_location_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1344,7 +1342,7 @@ def build_virtual_machines_capture_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1378,7 +1376,7 @@ def build_virtual_machines_create_or_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1412,7 +1410,7 @@ def build_virtual_machines_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1442,7 +1440,7 @@ def build_virtual_machines_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1475,7 +1473,7 @@ def build_virtual_machines_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1508,7 +1506,7 @@ def build_virtual_machines_instance_view_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1536,7 +1534,7 @@ def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1561,7 +1559,7 @@ def build_virtual_machines_deallocate_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1586,7 +1584,7 @@ def build_virtual_machines_generalize_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1612,7 +1610,7 @@ def build_virtual_machines_list_request(resource_group_name: str, subscription_i _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1670,7 +1668,7 @@ def build_virtual_machines_list_available_sizes_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1698,7 +1696,7 @@ def build_virtual_machines_power_off_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1728,7 +1726,7 @@ def build_virtual_machines_reapply_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1756,7 +1754,7 @@ def build_virtual_machines_restart_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1781,7 +1779,7 @@ def build_virtual_machines_start_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1806,7 +1804,7 @@ def build_virtual_machines_redeploy_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1833,7 +1831,7 @@ def build_virtual_machines_reimage_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1862,7 +1860,7 @@ def build_virtual_machines_perform_maintenance_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1891,7 +1889,7 @@ def build_virtual_machines_run_command_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1921,7 +1919,7 @@ def build_virtual_machine_sizes_list_request(location: str, subscription_id: str # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1952,7 +1950,7 @@ def build_images_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -1986,7 +1984,7 @@ def build_images_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -2016,7 +2014,7 @@ def build_images_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -2044,7 +2042,7 @@ def build_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -2077,7 +2075,7 @@ def build_images_list_by_resource_group_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2132,7 +2130,7 @@ def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2166,7 +2164,7 @@ def build_virtual_machine_scale_sets_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2196,7 +2194,7 @@ def build_virtual_machine_scale_sets_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2224,7 +2222,7 @@ def build_virtual_machine_scale_sets_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2254,7 +2252,7 @@ def build_virtual_machine_scale_sets_deallocate_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2285,7 +2283,7 @@ def build_virtual_machine_scale_sets_delete_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2317,7 +2315,7 @@ def build_virtual_machine_scale_sets_get_instance_view_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2348,7 +2346,7 @@ def build_virtual_machine_scale_sets_list_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2406,7 +2404,7 @@ def build_virtual_machine_scale_sets_list_skus_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2437,7 +2435,7 @@ def build_virtual_machine_scale_sets_get_os_upgrade_history_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2472,7 +2470,7 @@ def build_virtual_machine_scale_sets_power_off_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2505,7 +2503,7 @@ def build_virtual_machine_scale_sets_restart_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2536,7 +2534,7 @@ def build_virtual_machine_scale_sets_start_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2567,7 +2565,7 @@ def build_virtual_machine_scale_sets_redeploy_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2598,7 +2596,7 @@ def build_virtual_machine_scale_sets_perform_maintenance_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2629,7 +2627,7 @@ def build_virtual_machine_scale_sets_update_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2660,7 +2658,7 @@ def build_virtual_machine_scale_sets_reimage_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2691,7 +2689,7 @@ def build_virtual_machine_scale_sets_reimage_all_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2728,7 +2726,7 @@ def build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_upda _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2759,7 +2757,7 @@ def build_virtual_machine_scale_sets_convert_to_single_placement_group_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2792,7 +2790,7 @@ def build_virtual_machine_scale_set_extensions_create_or_update_request( # pyli _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2827,7 +2825,7 @@ def build_virtual_machine_scale_set_extensions_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2858,7 +2856,7 @@ def build_virtual_machine_scale_set_extensions_delete_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2893,7 +2891,7 @@ def build_virtual_machine_scale_set_extensions_get_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2927,7 +2925,7 @@ def build_virtual_machine_scale_set_extensions_list_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2955,7 +2953,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_cancel_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2980,7 +2978,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3005,7 +3003,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_req _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3033,7 +3031,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( # pyli _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3070,7 +3068,7 @@ def build_virtual_machine_scale_set_vm_extensions_create_or_update_request( # p _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3111,7 +3109,7 @@ def build_virtual_machine_scale_set_vm_extensions_update_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3151,7 +3149,7 @@ def build_virtual_machine_scale_set_vm_extensions_delete_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3191,7 +3189,7 @@ def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3232,7 +3230,7 @@ def build_virtual_machine_scale_set_vm_extensions_list_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3265,7 +3263,7 @@ def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3295,7 +3293,7 @@ def build_virtual_machine_scale_set_vms_reimage_all_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3321,7 +3319,7 @@ def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3351,7 +3349,7 @@ def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3382,7 +3380,7 @@ def build_virtual_machine_scale_set_vms_delete_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3417,7 +3415,7 @@ def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3451,7 +3449,7 @@ def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3490,7 +3488,7 @@ def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "virtualMachineScaleSetName": _SERIALIZER.url( @@ -3532,7 +3530,7 @@ def build_virtual_machine_scale_set_vms_power_off_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3560,7 +3558,7 @@ def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3586,7 +3584,7 @@ def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3612,7 +3610,7 @@ def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3638,7 +3636,7 @@ def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3668,7 +3666,7 @@ def build_virtual_machine_scale_set_vms_run_command_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3703,7 +3701,7 @@ def build_log_analytics_export_request_rate_by_interval_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -3736,7 +3734,7 @@ def build_log_analytics_export_throttled_requests_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -3769,7 +3767,7 @@ def build_disks_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3803,7 +3801,7 @@ def build_disks_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3836,7 +3834,7 @@ def build_disks_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3864,7 +3862,7 @@ def build_disks_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3892,7 +3890,7 @@ def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3947,7 +3945,7 @@ def build_disks_grant_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3977,7 +3975,7 @@ def build_disks_revoke_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4006,7 +4004,7 @@ def build_snapshots_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4040,7 +4038,7 @@ def build_snapshots_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4073,7 +4071,7 @@ def build_snapshots_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4101,7 +4099,7 @@ def build_snapshots_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4129,7 +4127,7 @@ def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4184,7 +4182,7 @@ def build_snapshots_grant_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4214,7 +4212,7 @@ def build_snapshots_revoke_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4243,7 +4241,7 @@ def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4277,7 +4275,7 @@ def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4310,7 +4308,7 @@ def build_disk_encryption_sets_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4341,7 +4339,7 @@ def build_disk_encryption_sets_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4372,7 +4370,7 @@ def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4427,7 +4425,7 @@ def build_galleries_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4461,7 +4459,7 @@ def build_galleries_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4494,7 +4492,7 @@ def build_galleries_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4525,7 +4523,7 @@ def build_galleries_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4556,7 +4554,7 @@ def build_galleries_list_by_resource_group_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4611,7 +4609,7 @@ def build_gallery_images_create_or_update_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4646,7 +4644,7 @@ def build_gallery_images_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4680,7 +4678,7 @@ def build_gallery_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4712,7 +4710,7 @@ def build_gallery_images_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4744,7 +4742,7 @@ def build_gallery_images_list_by_gallery_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4781,7 +4779,7 @@ def build_gallery_image_versions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4822,7 +4820,7 @@ def build_gallery_image_versions_update_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4864,7 +4862,7 @@ def build_gallery_image_versions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4904,7 +4902,7 @@ def build_gallery_image_versions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4937,7 +4935,7 @@ def build_gallery_image_versions_list_by_gallery_image_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4970,7 +4968,7 @@ def build_gallery_applications_create_or_update_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5005,7 +5003,7 @@ def build_gallery_applications_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5039,7 +5037,7 @@ def build_gallery_applications_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5071,7 +5069,7 @@ def build_gallery_applications_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5103,7 +5101,7 @@ def build_gallery_applications_list_by_gallery_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5140,7 +5138,7 @@ def build_gallery_application_versions_create_or_update_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5183,7 +5181,7 @@ def build_gallery_application_versions_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5227,7 +5225,7 @@ def build_gallery_application_versions_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5269,7 +5267,7 @@ def build_gallery_application_versions_delete_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5304,7 +5302,7 @@ def build_gallery_application_versions_list_by_gallery_application_request( # p _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5335,7 +5333,7 @@ def build_virtual_machine_run_commands_list_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -5365,7 +5363,7 @@ def build_virtual_machine_run_commands_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "commandId": _SERIALIZER.url("command_id", command_id, "str"), @@ -5397,10 +5395,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5493,10 +5491,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -6114,10 +6112,10 @@ class ProximityPlacementGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -6668,10 +6666,10 @@ class DedicatedHostGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -7208,10 +7206,10 @@ class DedicatedHostsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -7891,10 +7889,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8106,10 +8104,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -8784,10 +8782,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9117,10 +9115,10 @@ class UsageOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9216,10 +9214,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11607,10 +11605,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11706,10 +11704,10 @@ class ImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -12402,10 +12400,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -15469,10 +15467,10 @@ class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -16174,10 +16172,10 @@ class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-t def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -16563,10 +16561,10 @@ class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too- def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -17275,10 +17273,10 @@ class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-me def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _reimage_initial( @@ -19035,10 +19033,10 @@ class LogAnalyticsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _export_request_rate_by_interval_initial( @@ -19407,10 +19405,10 @@ class DisksOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -20405,10 +20403,10 @@ class SnapshotsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -21413,10 +21411,10 @@ class DiskEncryptionSetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -22142,10 +22140,10 @@ class GalleriesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -22846,10 +22844,10 @@ class GalleryImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -23541,10 +23539,10 @@ class GalleryImageVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -24319,10 +24317,10 @@ class GalleryApplicationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -25026,10 +25024,10 @@ class GalleryApplicationVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -25809,10 +25807,10 @@ class VirtualMachineRunCommandsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py index 33b3e2e11be7..122a8af4e691 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -127,7 +129,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-12-01". Note that overriding this default value may result in unsupported behavior. @@ -137,15 +139,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -164,7 +168,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_metadata.json index 4dc03b6591fb..b76ca8192dab 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_compute_management_client.py index 53acd83300e4..3cb569baea77 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -129,7 +131,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-12-01". Note that overriding this default value may result in unsupported behavior. @@ -139,15 +141,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -166,7 +170,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py index 822f133c8a60..69dad04e35ac 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import ( Any, AsyncIterable, @@ -25,6 +25,7 @@ ) import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -46,6 +47,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_availability_sets_create_or_update_request, build_availability_sets_delete_request, @@ -204,11 +206,8 @@ build_virtual_machines_start_request, build_virtual_machines_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -227,10 +226,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -323,10 +322,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -945,10 +944,10 @@ class ProximityPlacementGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -1497,10 +1496,10 @@ class DedicatedHostGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2039,10 +2038,10 @@ class DedicatedHostsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2729,10 +2728,10 @@ class SshPublicKeysOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3328,10 +3327,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3543,10 +3542,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -4221,10 +4220,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4554,10 +4553,10 @@ class UsageOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4653,10 +4652,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7112,10 +7111,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7212,10 +7211,10 @@ class ImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -7908,10 +7907,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -9142,7 +9141,6 @@ async def get_next(next_link=None): def get_os_upgrade_history( self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncIterable["_models.UpgradeOperationHistoricalStatusInfo"]: - # pylint: disable=line-too-long """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. Required. @@ -11168,10 +11166,10 @@ class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -11873,10 +11871,10 @@ class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-t def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _cancel_initial( @@ -12266,10 +12264,10 @@ class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too- def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -12978,10 +12976,10 @@ class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-me def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _reimage_initial( @@ -14797,10 +14795,10 @@ class LogAnalyticsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _export_request_rate_by_interval_initial( @@ -15171,10 +15169,10 @@ class VirtualMachineRunCommandsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -15325,10 +15323,10 @@ class GalleriesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -16035,10 +16033,10 @@ class GalleryImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -16731,10 +16729,10 @@ class GalleryImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -17509,10 +17507,10 @@ class GalleryApplicationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -18217,10 +18215,10 @@ class GalleryApplicationVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_compute_management_client_enums.py index 0373d6c581b0..4b5b90346ec3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_compute_management_client_enums.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py index 00be9471c26d..bfec235ce82d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AdditionalCapabilities(_serialization.Model): @@ -225,7 +220,7 @@ class AutomaticOSUpgradePolicy(_serialization.Model): applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. :code:`
    `\\ :code:`
    ` If this is set to true for Windows based scale sets, `enableAutomaticUpdates - `_ # pylint: disable=line-too-long + `_ is automatically set to false and cannot be set to true. :vartype enable_automatic_os_upgrade: bool :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default @@ -250,7 +245,7 @@ def __init__( applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. :code:`
    `\\ :code:`
    ` If this is set to true for Windows based scale sets, `enableAutomaticUpdates - `_ # pylint: disable=line-too-long + `_ is automatically set to false and cannot be set to true. :paramtype enable_automatic_os_upgrade: bool :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. @@ -368,9 +363,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -482,7 +477,7 @@ def __init__( self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines self.proximity_placement_group = proximity_placement_group - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None class AvailabilitySetListResult(_serialization.Model): @@ -613,7 +608,7 @@ def __init__( self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines self.proximity_placement_group = proximity_placement_group - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None class BillingProfile(_serialization.Model): @@ -719,9 +714,9 @@ class BootDiagnosticsInstanceView(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None - self.status = None + self.console_screenshot_blob_uri: Optional[str] = None + self.serial_console_log_blob_uri: Optional[str] = None + self.status: Optional["_models.InstanceViewStatus"] = None class ComputeOperationListResult(_serialization.Model): @@ -744,7 +739,7 @@ class ComputeOperationListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None + self.value: Optional[List["_models.ComputeOperationValue"]] = None class ComputeOperationValue(_serialization.Model): @@ -787,12 +782,12 @@ class ComputeOperationValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.origin = None - self.name = None - self.operation = None - self.resource = None - self.description = None - self.provider = None + self.origin: Optional[str] = None + self.name: Optional[str] = None + self.operation: Optional[str] = None + self.resource: Optional[str] = None + self.description: Optional[str] = None + self.provider: Optional[str] = None class DataDisk(_serialization.Model): @@ -938,8 +933,8 @@ def __init__( self.disk_size_gb = disk_size_gb self.managed_disk = managed_disk self.to_be_detached = to_be_detached - self.disk_iops_read_write = None - self.disk_m_bps_read_write = None + self.disk_iops_read_write: Optional[int] = None + self.disk_m_bps_read_write: Optional[int] = None class DataDiskImage(_serialization.Model): @@ -963,7 +958,7 @@ class DataDiskImage(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.lun = None + self.lun: Optional[int] = None class DiskImageEncryption(_serialization.Model): @@ -1137,12 +1132,12 @@ def __init__( self.sku = sku self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure - self.host_id = None - self.virtual_machines = None + self.host_id: Optional[str] = None + self.virtual_machines: Optional[List["_models.SubResourceReadOnly"]] = None self.license_type = license_type - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.DedicatedHostInstanceView"] = None class DedicatedHostAllocatableVM(_serialization.Model): @@ -1273,7 +1268,7 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count - self.hosts = None + self.hosts: Optional[List["_models.SubResourceReadOnly"]] = None class DedicatedHostGroupListResult(_serialization.Model): @@ -1363,7 +1358,7 @@ def __init__( super().__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count - self.hosts = None + self.hosts: Optional[List["_models.SubResourceReadOnly"]] = None class DedicatedHostInstanceView(_serialization.Model): @@ -1406,7 +1401,7 @@ def __init__( :paramtype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.asset_id = None + self.asset_id: Optional[str] = None self.available_capacity = available_capacity self.statuses = statuses @@ -1527,12 +1522,12 @@ def __init__( super().__init__(tags=tags, **kwargs) self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure - self.host_id = None - self.virtual_machines = None + self.host_id: Optional[str] = None + self.virtual_machines: Optional[List["_models.SubResourceReadOnly"]] = None self.license_type = license_type - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.DedicatedHostInstanceView"] = None class DiagnosticsProfile(_serialization.Model): @@ -1849,7 +1844,7 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.description = description self.identifier = identifier - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryPropertiesProvisioningState"]] = None class GalleryApplication(Resource): @@ -2027,9 +2022,9 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -2197,8 +2192,10 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None - self.replication_status = None + self.provisioning_state: Optional[ + Union[str, "_models.GalleryApplicationVersionPropertiesProvisioningState"] + ] = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryApplicationVersionList(_serialization.Model): @@ -2310,7 +2307,7 @@ def __init__( self.target_regions = target_regions self.replica_count = replica_count self.exclude_from_latest = exclude_from_latest - self.published_date = None + self.published_date: Optional[datetime.datetime] = None self.end_of_life_date = end_of_life_date self.storage_account_type = storage_account_type @@ -2480,8 +2477,10 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None - self.replication_status = None + self.provisioning_state: Optional[ + Union[str, "_models.GalleryApplicationVersionPropertiesProvisioningState"] + ] = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryArtifactSource(_serialization.Model): @@ -2571,7 +2570,7 @@ def __init__( :paramtype source: ~azure.mgmt.compute.v2019_12_01.models.GalleryArtifactVersionSource """ super().__init__(**kwargs) - self.size_in_gb = None + self.size_in_gb: Optional[int] = None self.host_caching = host_caching self.source = source @@ -2652,7 +2651,7 @@ class GalleryIdentifier(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.unique_name = None + self.unique_name: Optional[str] = None class GalleryImage(Resource): @@ -2813,7 +2812,7 @@ def __init__( self.recommended = recommended self.disallowed = disallowed self.purchase_plan = purchase_plan - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImagePropertiesProvisioningState"]] = None class GalleryImageIdentifier(_serialization.Model): @@ -3039,7 +3038,7 @@ def __init__( self.recommended = recommended self.disallowed = disallowed self.purchase_plan = purchase_plan - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImagePropertiesProvisioningState"]] = None class GalleryImageVersion(Resource): @@ -3117,9 +3116,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImageVersionPropertiesProvisioningState"]] = None self.storage_profile = storage_profile - self.replication_status = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryImageVersionList(_serialization.Model): @@ -3290,9 +3289,9 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImageVersionPropertiesProvisioningState"]] = None self.storage_profile = storage_profile - self.replication_status = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryList(_serialization.Model): @@ -3405,7 +3404,7 @@ def __init__( super().__init__(tags=tags, **kwargs) self.description = description self.identifier = identifier - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryPropertiesProvisioningState"]] = None class HardwareProfile(_serialization.Model): @@ -3413,7 +3412,7 @@ class HardwareProfile(_serialization.Model): :ivar vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: :code:`
    `\\ :code:`
    ` `List all available virtual machine sizes in an availability set @@ -3470,7 +3469,7 @@ def __init__( """ :keyword vm_size: Specifies the size of the virtual machine. For more information about virtual machine sizes, see `Sizes for virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: :code:`
    `\\ :code:`
    ` `List all available virtual machine sizes in an availability set @@ -3598,7 +3597,7 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.hyper_v_generation = hyper_v_generation @@ -4065,7 +4064,7 @@ def __init__( self.offer = offer self.sku = sku self.version = version - self.exact_version = None + self.exact_version: Optional[str] = None class ImageStorageProfile(_serialization.Model): @@ -4074,12 +4073,12 @@ class ImageStorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2019_12_01.models.ImageOSDisk :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2019_12_01.models.ImageDataDisk] :ivar zone_resilient: Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). @@ -4104,12 +4103,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2019_12_01.models.ImageOSDisk :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2019_12_01.models.ImageDataDisk] :keyword zone_resilient: Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). @@ -4176,7 +4175,7 @@ def __init__( super().__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.hyper_v_generation = hyper_v_generation @@ -4504,7 +4503,7 @@ class LogAnalyticsOperationResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.properties = None + self.properties: Optional["_models.LogAnalyticsOutput"] = None class LogAnalyticsOutput(_serialization.Model): @@ -4527,7 +4526,7 @@ class LogAnalyticsOutput(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.output = None + self.output: Optional[str] = None class MaintenanceRedeployStatus(_serialization.Model): @@ -4803,8 +4802,8 @@ class OrchestrationServiceSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.service_name = None - self.service_state = None + self.service_name: Optional[Union[str, "_models.OrchestrationServiceNames"]] = None + self.service_state: Optional[Union[str, "_models.OrchestrationServiceState"]] = None class OSDisk(_serialization.Model): @@ -4997,7 +4996,7 @@ class OSProfile(_serialization.Model): **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :vartype computer_name: str :ivar admin_username: Specifies the name of the administrator account. :code:`
    `\\ :code:`
    ` This property cannot be updated after the VM is created. :code:`
    `\\ @@ -5010,10 +5009,10 @@ class OSProfile(_serialization.Model): :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -5026,10 +5025,10 @@ class OSProfile(_serialization.Model): "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :vartype admin_password: str :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum @@ -5040,7 +5039,7 @@ class OSProfile(_serialization.Model): `_ :code:`
    `\\ :code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :vartype custom_data: str :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -5048,10 +5047,10 @@ class OSProfile(_serialization.Model): :ivar linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :vartype linux_configuration: ~azure.mgmt.compute.v2019_12_01.models.LinuxConfiguration :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. :vartype secrets: list[~azure.mgmt.compute.v2019_12_01.models.VaultSecretGroup] @@ -5096,7 +5095,7 @@ def __init__( **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :paramtype computer_name: str :keyword admin_username: Specifies the name of the administrator account. :code:`
    `\\ :code:`
    ` This property cannot be updated after the VM is created. :code:`
    `\\ @@ -5109,10 +5108,10 @@ def __init__( :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -5125,10 +5124,10 @@ def __init__( "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :paramtype admin_password: str :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum @@ -5139,7 +5138,7 @@ def __init__( `_ :code:`
    `\\ :code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :paramtype custom_data: str :keyword windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -5147,10 +5146,10 @@ def __init__( :keyword linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :paramtype linux_configuration: ~azure.mgmt.compute.v2019_12_01.models.LinuxConfiguration :keyword secrets: Specifies set of certificates that should be installed onto the virtual machine. @@ -5317,9 +5316,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type - self.virtual_machines = None - self.virtual_machine_scale_sets = None - self.availability_sets = None + self.virtual_machines: Optional[List["_models.SubResourceWithColocationStatus"]] = None + self.virtual_machine_scale_sets: Optional[List["_models.SubResourceWithColocationStatus"]] = None + self.availability_sets: Optional[List["_models.SubResourceWithColocationStatus"]] = None self.colocation_status = colocation_status @@ -5465,8 +5464,8 @@ class RecoveryWalkResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.walk_performed = None - self.next_platform_update_domain = None + self.walk_performed: Optional[bool] = None + self.next_platform_update_domain: Optional[int] = None class RegionalReplicationStatus(_serialization.Model): @@ -5502,10 +5501,10 @@ class RegionalReplicationStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.region = None - self.state = None - self.details = None - self.progress = None + self.region: Optional[str] = None + self.state: Optional[Union[str, "_models.ReplicationState"]] = None + self.details: Optional[str] = None + self.progress: Optional[int] = None class ReplicationStatus(_serialization.Model): @@ -5534,8 +5533,8 @@ class ReplicationStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.aggregated_state = None - self.summary = None + self.aggregated_state: Optional[Union[str, "_models.AggregatedReplicationState"]] = None + self.summary: Optional[List["_models.RegionalReplicationStatus"]] = None class RequestRateByIntervalInput(LogAnalyticsInputBase): @@ -5681,9 +5680,9 @@ class RollbackStatusInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successfully_rolledback_instance_count = None - self.failed_rolledback_instance_count = None - self.rollback_error = None + self.successfully_rolledback_instance_count: Optional[int] = None + self.failed_rolledback_instance_count: Optional[int] = None + self.rollback_error: Optional["_models.ApiError"] = None class RollingUpgradePolicy(_serialization.Model): @@ -5795,10 +5794,10 @@ class RollingUpgradeProgressInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successful_instance_count = None - self.failed_instance_count = None - self.in_progress_instance_count = None - self.pending_instance_count = None + self.successful_instance_count: Optional[int] = None + self.failed_instance_count: Optional[int] = None + self.in_progress_instance_count: Optional[int] = None + self.pending_instance_count: Optional[int] = None class RollingUpgradeRunningStatus(_serialization.Model): @@ -5835,10 +5834,10 @@ class RollingUpgradeRunningStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.last_action = None - self.last_action_time = None + self.code: Optional[Union[str, "_models.RollingUpgradeStatusCode"]] = None + self.start_time: Optional[datetime.datetime] = None + self.last_action: Optional[Union[str, "_models.RollingUpgradeActionType"]] = None + self.last_action_time: Optional[datetime.datetime] = None class RollingUpgradeStatusInfo(Resource): @@ -5900,10 +5899,10 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(location=location, tags=tags, **kwargs) - self.policy = None - self.running_status = None - self.progress = None - self.error = None + self.policy: Optional["_models.RollingUpgradePolicy"] = None + self.running_status: Optional["_models.RollingUpgradeRunningStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None class RunCommandDocumentBase(_serialization.Model): @@ -6376,7 +6375,7 @@ class SshPublicKey(_serialization.Model): :ivar key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `\\ :code:`
    ` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. # pylint: disable=line-too-long + `_. :vartype key_data: str """ @@ -6394,7 +6393,7 @@ def __init__(self, *, path: Optional[str] = None, key_data: Optional[str] = None :keyword key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `\\ :code:`
    ` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. # pylint: disable=line-too-long + `_. :paramtype key_data: str """ super().__init__(**kwargs) @@ -6415,7 +6414,7 @@ class SshPublicKeyGenerateKeyPairResult(_serialization.Model): through ssh. The public key is in ssh-rsa format. Required. :vartype public_key: str :ivar id: The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. Required. :vartype id: str """ @@ -6444,7 +6443,7 @@ def __init__( machine through ssh. The public key is in ssh-rsa format. Required. :paramtype public_key: str :keyword id: The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. Required. :paramtype id: str """ @@ -6592,12 +6591,12 @@ class StorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2019_12_01.models.OSDisk :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2019_12_01.models.DataDisk] """ @@ -6624,12 +6623,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2019_12_01.models.OSDisk :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2019_12_01.models.DataDisk] """ super().__init__(**kwargs) @@ -6658,7 +6657,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class SubResourceWithColocationStatus(SubResource): @@ -6839,9 +6838,9 @@ class UpgradeOperationHistoricalStatusInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.properties = None - self.type = None - self.location = None + self.properties: Optional["_models.UpgradeOperationHistoricalStatusInfoProperties"] = None + self.type: Optional[str] = None + self.location: Optional[str] = None class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # pylint: disable=name-too-long @@ -6885,12 +6884,12 @@ class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # p def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.running_status = None - self.progress = None - self.error = None - self.started_by = None - self.target_image_reference = None - self.rollback_info = None + self.running_status: Optional["_models.UpgradeOperationHistoryStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None + self.started_by: Optional[Union[str, "_models.UpgradeOperationInvoker"]] = None + self.target_image_reference: Optional["_models.ImageReference"] = None + self.rollback_info: Optional["_models.RollbackStatusInfo"] = None class UpgradeOperationHistoryStatus(_serialization.Model): @@ -6922,9 +6921,9 @@ class UpgradeOperationHistoryStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.end_time = None + self.code: Optional[Union[str, "_models.UpgradeState"]] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None class UpgradePolicy(_serialization.Model): @@ -7164,8 +7163,8 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class VaultCertificate(_serialization.Model): @@ -7323,10 +7322,10 @@ class VirtualMachine(Resource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. @@ -7373,7 +7372,7 @@ class VirtualMachine(Resource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar vm_id: Specifies the VM unique ID which is a 128-bits identifier that is encoded and @@ -7480,10 +7479,10 @@ def __init__( # pylint: disable=too-many-locals machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. @@ -7526,13 +7525,13 @@ def __init__( # pylint: disable=too-many-locals element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str """ super().__init__(location=location, tags=tags, **kwargs) self.plan = plan - self.resources = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None self.identity = identity self.zones = zones self.hardware_profile = hardware_profile @@ -7548,10 +7547,10 @@ def __init__( # pylint: disable=too-many-locals self.eviction_policy = eviction_policy self.billing_profile = billing_profile self.host = host - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None class VirtualMachineAgentInstanceView(_serialization.Model): @@ -7677,10 +7676,10 @@ def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylin :paramtype id: str """ super().__init__(id=id, **kwargs) - self.schema = None - self.content_version = None - self.parameters = None - self.resources = None + self.schema: Optional[str] = None + self.content_version: Optional[str] = None + self.parameters: Optional[JSON] = None + self.resources: Optional[List[JSON]] = None class VirtualMachineExtension(Resource): @@ -7802,7 +7801,7 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.instance_view = instance_view @@ -8110,7 +8109,7 @@ class VirtualMachineHealthStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None + self.status: Optional["_models.InstanceViewStatus"] = None class VirtualMachineIdentity(_serialization.Model): @@ -8131,7 +8130,7 @@ class VirtualMachineIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.compute.v2019_12_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_12_01.models.UserAssignedIdentitiesValue] """ @@ -8163,13 +8162,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.compute.v2019_12_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_12_01.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -8707,10 +8706,10 @@ def __init__( self.upgrade_policy = upgrade_policy self.automatic_repairs_policy = automatic_repairs_policy self.virtual_machine_profile = virtual_machine_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.overprovision = overprovision self.do_not_run_extensions_on_overprovisioned_v_ms = do_not_run_extensions_on_overprovisioned_v_ms - self.unique_id = None + self.unique_id: Optional[str] = None self.single_placement_group = single_placement_group self.zone_balance = zone_balance self.platform_fault_domain_count = platform_fault_domain_count @@ -8937,7 +8936,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.type = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -8945,7 +8944,7 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.provision_after_extensions = provision_after_extensions @@ -9106,8 +9105,8 @@ def __init__( :paramtype provision_after_extensions: list[str] """ super().__init__(**kwargs) - self.name = None - self.type = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -9115,7 +9114,7 @@ def __init__( self.auto_upgrade_minor_version = auto_upgrade_minor_version self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.provision_after_extensions = provision_after_extensions @@ -9138,7 +9137,7 @@ class VirtualMachineScaleSetIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.compute.v2019_12_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -9177,13 +9176,13 @@ def __init__( :keyword user_assigned_identities: The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -9212,8 +9211,8 @@ class VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue(_serialization.M def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class VirtualMachineScaleSetInstanceView(_serialization.Model): @@ -9253,10 +9252,10 @@ def __init__(self, *, statuses: Optional[List["_models.InstanceViewStatus"]] = N :paramtype statuses: list[~azure.mgmt.compute.v2019_12_01.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.virtual_machine = None - self.extensions = None + self.virtual_machine: Optional["_models.VirtualMachineScaleSetInstanceViewStatusesSummary"] = None + self.extensions: Optional[List["_models.VirtualMachineScaleSetVMExtensionsSummary"]] = None self.statuses = statuses - self.orchestration_services = None + self.orchestration_services: Optional[List["_models.OrchestrationServiceSummary"]] = None class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): # pylint: disable=name-too-long @@ -9280,7 +9279,7 @@ class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.statuses_summary = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetIPConfiguration(SubResource): @@ -9750,7 +9749,7 @@ class VirtualMachineScaleSetNetworkProfile(_serialization.Model): :ivar health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :vartype health_probe: ~azure.mgmt.compute.v2019_12_01.models.ApiEntityReference :ivar network_interface_configurations: The list of network configurations. :vartype network_interface_configurations: @@ -9775,7 +9774,7 @@ def __init__( """ :keyword health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :paramtype health_probe: ~azure.mgmt.compute.v2019_12_01.models.ApiEntityReference :keyword network_interface_configurations: The list of network configurations. :paramtype network_interface_configurations: @@ -9932,10 +9931,10 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -9948,16 +9947,16 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :vartype admin_password: str :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :vartype custom_data: str :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -9965,10 +9964,10 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): :ivar linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :vartype linux_configuration: ~azure.mgmt.compute.v2019_12_01.models.LinuxConfiguration :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines in the scale set. @@ -10011,10 +10010,10 @@ def __init__( :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -10027,16 +10026,16 @@ def __init__( "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :paramtype admin_password: str :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :paramtype custom_data: str :keyword windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -10044,10 +10043,10 @@ def __init__( :keyword linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :paramtype linux_configuration: ~azure.mgmt.compute.v2019_12_01.models.LinuxConfiguration :keyword secrets: Specifies set of certificates that should be installed onto the virtual machines in the scale set. @@ -10240,9 +10239,9 @@ class VirtualMachineScaleSetSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.resource_type = None - self.sku = None - self.capacity = None + self.resource_type: Optional[str] = None + self.sku: Optional["_models.Sku"] = None + self.capacity: Optional["_models.VirtualMachineScaleSetSkuCapacity"] = None class VirtualMachineScaleSetSkuCapacity(_serialization.Model): @@ -10279,10 +10278,10 @@ class VirtualMachineScaleSetSkuCapacity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default_capacity = None - self.scale_type = None + self.minimum: Optional[int] = None + self.maximum: Optional[int] = None + self.default_capacity: Optional[int] = None + self.scale_type: Optional[Union[str, "_models.VirtualMachineScaleSetSkuScaleType"]] = None class VirtualMachineScaleSetStorageProfile(_serialization.Model): @@ -10296,12 +10295,12 @@ class VirtualMachineScaleSetStorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetOSDisk :ivar data_disks: Specifies the parameters that are used to add data disks to the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetDataDisk] """ @@ -10329,12 +10328,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetOSDisk :keyword data_disks: Specifies the parameters that are used to add data disks to the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetDataDisk] """ @@ -10694,7 +10693,7 @@ class VirtualMachineScaleSetUpdateNetworkProfile(_serialization.Model): # pylin :ivar health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :vartype health_probe: ~azure.mgmt.compute.v2019_12_01.models.ApiEntityReference :ivar network_interface_configurations: The list of network configurations. :vartype network_interface_configurations: @@ -10721,7 +10720,7 @@ def __init__( """ :keyword health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :paramtype health_probe: ~azure.mgmt.compute.v2019_12_01.models.ApiEntityReference :keyword network_interface_configurations: The list of network configurations. :paramtype network_interface_configurations: @@ -11084,10 +11083,10 @@ class VirtualMachineScaleSetVM(Resource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :vartype availability_set: ~azure.mgmt.compute.v2019_12_01.models.SubResource @@ -11100,7 +11099,7 @@ class VirtualMachineScaleSetVM(Resource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar model_definition_applied: Specifies whether the model applied to the virtual machine is @@ -11211,10 +11210,10 @@ def __init__( # pylint: disable=too-many-locals machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :paramtype availability_set: ~azure.mgmt.compute.v2019_12_01.models.SubResource @@ -11225,7 +11224,7 @@ def __init__( # pylint: disable=too-many-locals element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str :keyword protection_policy: Specifies the protection policy of the virtual machine. @@ -11233,14 +11232,14 @@ def __init__( # pylint: disable=too-many-locals ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMProtectionPolicy """ super().__init__(location=location, tags=tags, **kwargs) - self.instance_id = None - self.sku = None + self.instance_id: Optional[str] = None + self.sku: Optional["_models.Sku"] = None self.plan = plan - self.resources = None - self.zones = None - self.latest_model_applied = None - self.vm_id = None - self.instance_view = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None + self.zones: Optional[List[str]] = None + self.latest_model_applied: Optional[bool] = None + self.vm_id: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineScaleSetVMInstanceView"] = None self.hardware_profile = hardware_profile self.storage_profile = storage_profile self.additional_capabilities = additional_capabilities @@ -11249,9 +11248,9 @@ def __init__( # pylint: disable=too-many-locals self.network_profile_configuration = network_profile_configuration self.diagnostics_profile = diagnostics_profile self.availability_set = availability_set - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.license_type = license_type - self.model_definition_applied = None + self.model_definition_applied: Optional[str] = None self.protection_policy = protection_policy @@ -11280,8 +11279,8 @@ class VirtualMachineScaleSetVMExtensionsSummary(_serialization.Model): # pylint def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.statuses_summary = None + self.name: Optional[str] = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetVMInstanceIDs(_serialization.Model): @@ -11438,7 +11437,7 @@ def __init__( self.maintenance_redeploy_status = maintenance_redeploy_status self.disks = disks self.extensions = extensions - self.vm_health = None + self.vm_health: Optional["_models.VirtualMachineHealthStatus"] = None self.boot_diagnostics = boot_diagnostics self.statuses = statuses self.placement_group_id = placement_group_id @@ -11537,7 +11536,7 @@ class VirtualMachineScaleSetVMProfile(_serialization.Model): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar priority: Specifies the priority for the virtual machines in the scale set. @@ -11613,7 +11612,7 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str :keyword priority: Specifies the priority for the virtual machines in the scale set. @@ -11794,8 +11793,8 @@ class VirtualMachineStatusCodeCount(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.count = None + self.code: Optional[str] = None + self.count: Optional[int] = None class VirtualMachineUpdate(UpdateResource): @@ -11834,10 +11833,10 @@ class VirtualMachineUpdate(UpdateResource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. @@ -11884,7 +11883,7 @@ class VirtualMachineUpdate(UpdateResource): element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :vartype license_type: str :ivar vm_id: Specifies the VM unique ID which is a 128-bits identifier that is encoded and @@ -11978,10 +11977,10 @@ def __init__( machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. @@ -12024,7 +12023,7 @@ def __init__( element is included in a request for an update, the value must match the initial value. This value cannot be updated. :code:`
    `\\ :code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Minimum api-version: 2015-06-15. :paramtype license_type: str """ @@ -12045,10 +12044,10 @@ def __init__( self.eviction_policy = eviction_policy self.billing_profile = billing_profile self.host = host - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None class VMScaleSetConvertToSinglePlacementGroupInput(_serialization.Model): # pylint: disable=name-too-long diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py index 5f588b38cbf4..557a3067da13 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +75,7 @@ def build_availability_sets_create_or_update_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -111,7 +109,7 @@ def build_availability_sets_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -141,7 +139,7 @@ def build_availability_sets_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -169,7 +167,7 @@ def build_availability_sets_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -226,7 +224,7 @@ def build_availability_sets_list_request(resource_group_name: str, subscription_ _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -256,7 +254,7 @@ def build_availability_sets_list_available_sizes_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -288,7 +286,7 @@ def build_proximity_placement_groups_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -324,7 +322,7 @@ def build_proximity_placement_groups_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -356,7 +354,7 @@ def build_proximity_placement_groups_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -391,7 +389,7 @@ def build_proximity_placement_groups_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -456,7 +454,7 @@ def build_proximity_placement_groups_list_by_resource_group_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -487,7 +485,7 @@ def build_dedicated_host_groups_create_or_update_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -521,7 +519,7 @@ def build_dedicated_host_groups_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -551,7 +549,7 @@ def build_dedicated_host_groups_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -579,7 +577,7 @@ def build_dedicated_host_groups_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -610,7 +608,7 @@ def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -667,7 +665,7 @@ def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -702,7 +700,7 @@ def build_dedicated_hosts_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -733,7 +731,7 @@ def build_dedicated_hosts_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -768,7 +766,7 @@ def build_dedicated_hosts_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -802,7 +800,7 @@ def build_dedicated_hosts_list_by_host_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -859,7 +857,7 @@ def build_ssh_public_keys_list_by_resource_group_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -890,7 +888,7 @@ def build_ssh_public_keys_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -924,7 +922,7 @@ def build_ssh_public_keys_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -954,7 +952,7 @@ def build_ssh_public_keys_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -982,7 +980,7 @@ def build_ssh_public_keys_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -1013,7 +1011,7 @@ def build_ssh_public_keys_generate_key_pair_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -1044,7 +1042,7 @@ def build_virtual_machine_extension_images_get_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1077,7 +1075,7 @@ def build_virtual_machine_extension_images_list_types_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1116,7 +1114,7 @@ def build_virtual_machine_extension_images_list_versions_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1155,7 +1153,7 @@ def build_virtual_machine_extensions_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1190,7 +1188,7 @@ def build_virtual_machine_extensions_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1221,7 +1219,7 @@ def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1256,7 +1254,7 @@ def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1290,7 +1288,7 @@ def build_virtual_machine_extensions_list_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1323,7 +1321,7 @@ def build_virtual_machine_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1366,7 +1364,7 @@ def build_virtual_machine_images_list_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1405,7 +1403,7 @@ def build_virtual_machine_images_list_offers_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1435,7 +1433,7 @@ def build_virtual_machine_images_list_publishers_request( # pylint: disable=nam # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1465,7 +1463,7 @@ def build_virtual_machine_images_list_skus_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1494,7 +1492,7 @@ def build_usage_list_request(location: str, subscription_id: str, **kwargs: Any) # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1524,7 +1522,7 @@ def build_virtual_machines_list_by_location_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1555,7 +1553,7 @@ def build_virtual_machines_capture_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1589,7 +1587,7 @@ def build_virtual_machines_create_or_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1623,7 +1621,7 @@ def build_virtual_machines_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1653,7 +1651,7 @@ def build_virtual_machines_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1686,7 +1684,7 @@ def build_virtual_machines_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1719,7 +1717,7 @@ def build_virtual_machines_instance_view_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1747,7 +1745,7 @@ def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1772,7 +1770,7 @@ def build_virtual_machines_deallocate_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1797,7 +1795,7 @@ def build_virtual_machines_generalize_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1823,7 +1821,7 @@ def build_virtual_machines_list_request(resource_group_name: str, subscription_i _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1881,7 +1879,7 @@ def build_virtual_machines_list_available_sizes_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1909,7 +1907,7 @@ def build_virtual_machines_power_off_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1939,7 +1937,7 @@ def build_virtual_machines_reapply_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1967,7 +1965,7 @@ def build_virtual_machines_restart_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1992,7 +1990,7 @@ def build_virtual_machines_start_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2017,7 +2015,7 @@ def build_virtual_machines_redeploy_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2044,7 +2042,7 @@ def build_virtual_machines_reimage_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2073,7 +2071,7 @@ def build_virtual_machines_perform_maintenance_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2098,7 +2096,7 @@ def build_virtual_machines_simulate_eviction_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2127,7 +2125,7 @@ def build_virtual_machines_run_command_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2157,7 +2155,7 @@ def build_virtual_machine_sizes_list_request(location: str, subscription_id: str # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2188,7 +2186,7 @@ def build_images_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -2222,7 +2220,7 @@ def build_images_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -2252,7 +2250,7 @@ def build_images_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -2280,7 +2278,7 @@ def build_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -2313,7 +2311,7 @@ def build_images_list_by_resource_group_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2368,7 +2366,7 @@ def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2402,7 +2400,7 @@ def build_virtual_machine_scale_sets_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2432,7 +2430,7 @@ def build_virtual_machine_scale_sets_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2460,7 +2458,7 @@ def build_virtual_machine_scale_sets_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2490,7 +2488,7 @@ def build_virtual_machine_scale_sets_deallocate_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2521,7 +2519,7 @@ def build_virtual_machine_scale_sets_delete_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2553,7 +2551,7 @@ def build_virtual_machine_scale_sets_get_instance_view_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2584,7 +2582,7 @@ def build_virtual_machine_scale_sets_list_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2642,7 +2640,7 @@ def build_virtual_machine_scale_sets_list_skus_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2673,7 +2671,7 @@ def build_virtual_machine_scale_sets_get_os_upgrade_history_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2708,7 +2706,7 @@ def build_virtual_machine_scale_sets_power_off_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2741,7 +2739,7 @@ def build_virtual_machine_scale_sets_restart_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2772,7 +2770,7 @@ def build_virtual_machine_scale_sets_start_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2803,7 +2801,7 @@ def build_virtual_machine_scale_sets_redeploy_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2834,7 +2832,7 @@ def build_virtual_machine_scale_sets_perform_maintenance_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2865,7 +2863,7 @@ def build_virtual_machine_scale_sets_update_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2896,7 +2894,7 @@ def build_virtual_machine_scale_sets_reimage_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2927,7 +2925,7 @@ def build_virtual_machine_scale_sets_reimage_all_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2964,7 +2962,7 @@ def build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_upda _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2995,7 +2993,7 @@ def build_virtual_machine_scale_sets_convert_to_single_placement_group_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3026,7 +3024,7 @@ def build_virtual_machine_scale_sets_set_orchestration_service_state_request( # _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3059,7 +3057,7 @@ def build_virtual_machine_scale_set_extensions_create_or_update_request( # pyli _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3094,7 +3092,7 @@ def build_virtual_machine_scale_set_extensions_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3125,7 +3123,7 @@ def build_virtual_machine_scale_set_extensions_delete_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3160,7 +3158,7 @@ def build_virtual_machine_scale_set_extensions_get_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3194,7 +3192,7 @@ def build_virtual_machine_scale_set_extensions_list_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3222,7 +3220,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_cancel_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3247,7 +3245,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3272,7 +3270,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_req _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3300,7 +3298,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( # pyli _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3337,7 +3335,7 @@ def build_virtual_machine_scale_set_vm_extensions_create_or_update_request( # p _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3378,7 +3376,7 @@ def build_virtual_machine_scale_set_vm_extensions_update_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3418,7 +3416,7 @@ def build_virtual_machine_scale_set_vm_extensions_delete_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3458,7 +3456,7 @@ def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3499,7 +3497,7 @@ def build_virtual_machine_scale_set_vm_extensions_list_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3532,7 +3530,7 @@ def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3562,7 +3560,7 @@ def build_virtual_machine_scale_set_vms_reimage_all_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3588,7 +3586,7 @@ def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3618,7 +3616,7 @@ def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3649,7 +3647,7 @@ def build_virtual_machine_scale_set_vms_delete_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3684,7 +3682,7 @@ def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3718,7 +3716,7 @@ def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3757,7 +3755,7 @@ def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "virtualMachineScaleSetName": _SERIALIZER.url( @@ -3799,7 +3797,7 @@ def build_virtual_machine_scale_set_vms_power_off_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3827,7 +3825,7 @@ def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3853,7 +3851,7 @@ def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3879,7 +3877,7 @@ def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3905,7 +3903,7 @@ def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3931,7 +3929,7 @@ def build_virtual_machine_scale_set_vms_simulate_eviction_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3961,7 +3959,7 @@ def build_virtual_machine_scale_set_vms_run_command_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3996,7 +3994,7 @@ def build_log_analytics_export_request_rate_by_interval_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -4029,7 +4027,7 @@ def build_log_analytics_export_throttled_requests_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -4060,7 +4058,7 @@ def build_virtual_machine_run_commands_list_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -4090,7 +4088,7 @@ def build_virtual_machine_run_commands_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "commandId": _SERIALIZER.url("command_id", command_id, "str"), @@ -4122,7 +4120,7 @@ def build_galleries_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4156,7 +4154,7 @@ def build_galleries_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4189,7 +4187,7 @@ def build_galleries_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4220,7 +4218,7 @@ def build_galleries_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4251,7 +4249,7 @@ def build_galleries_list_by_resource_group_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4306,7 +4304,7 @@ def build_gallery_images_create_or_update_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4341,7 +4339,7 @@ def build_gallery_images_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4375,7 +4373,7 @@ def build_gallery_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4407,7 +4405,7 @@ def build_gallery_images_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4439,7 +4437,7 @@ def build_gallery_images_list_by_gallery_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4476,7 +4474,7 @@ def build_gallery_image_versions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4517,7 +4515,7 @@ def build_gallery_image_versions_update_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4559,7 +4557,7 @@ def build_gallery_image_versions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4599,7 +4597,7 @@ def build_gallery_image_versions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4632,7 +4630,7 @@ def build_gallery_image_versions_list_by_gallery_image_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4665,7 +4663,7 @@ def build_gallery_applications_create_or_update_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4700,7 +4698,7 @@ def build_gallery_applications_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4734,7 +4732,7 @@ def build_gallery_applications_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4766,7 +4764,7 @@ def build_gallery_applications_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4798,7 +4796,7 @@ def build_gallery_applications_list_by_gallery_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4835,7 +4833,7 @@ def build_gallery_application_versions_create_or_update_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4878,7 +4876,7 @@ def build_gallery_application_versions_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4922,7 +4920,7 @@ def build_gallery_application_versions_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4964,7 +4962,7 @@ def build_gallery_application_versions_delete_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -4999,7 +4997,7 @@ def build_gallery_application_versions_list_by_gallery_application_request( # p _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5032,10 +5030,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5128,10 +5126,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -5749,10 +5747,10 @@ class ProximityPlacementGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -6303,10 +6301,10 @@ class DedicatedHostGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -6843,10 +6841,10 @@ class DedicatedHostsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -7526,10 +7524,10 @@ class SshPublicKeysOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8125,10 +8123,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8340,10 +8338,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -9018,10 +9016,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9351,10 +9349,10 @@ class UsageOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9450,10 +9448,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11894,10 +11892,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11993,10 +11991,10 @@ class ImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -12689,10 +12687,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -15942,10 +15940,10 @@ class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -16647,10 +16645,10 @@ class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-t def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -17036,10 +17034,10 @@ class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too- def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -17748,10 +17746,10 @@ class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-me def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _reimage_initial( @@ -19564,10 +19562,10 @@ class LogAnalyticsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _export_request_rate_by_interval_initial( @@ -19936,10 +19934,10 @@ class VirtualMachineRunCommandsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -20090,10 +20088,10 @@ class GalleriesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -20794,10 +20792,10 @@ class GalleryImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -21489,10 +21487,10 @@ class GalleryImageVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -22267,10 +22265,10 @@ class GalleryApplicationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -22974,10 +22972,10 @@ class GalleryApplicationVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_compute_management_client.py index d917f96f37a4..f5f51e1f4787 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-05-01". Note that overriding this default value may result in unsupported behavior. @@ -51,15 +53,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -78,7 +82,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_metadata.json index 9c8456602c4b..4ee60e268754 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_compute_management_client.py index 316f5a911c5f..69f49625a89c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-05-01". Note that overriding this default value may result in unsupported behavior. @@ -51,15 +53,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -78,7 +82,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_operations.py index c742c2ba1bac..52a87fa6de41 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_operations.py @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_disk_accesses_create_or_update_request, build_disk_accesses_delete_request, @@ -63,11 +65,8 @@ build_snapshots_revoke_access_request, build_snapshots_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,10 +85,10 @@ class DisksOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -1091,10 +1090,10 @@ class SnapshotsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2116,10 +2115,10 @@ class DiskEncryptionSetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2859,10 +2858,10 @@ class DiskAccessesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_models_py3.py index f6e5cf75345f..894056e4e6f8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/models/_models_py3.py @@ -35,7 +35,7 @@ class AccessUri(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.access_sas = None + self.access_sas: Optional[str] = None class ApiError(_serialization.Model): @@ -220,7 +220,7 @@ def __init__( self.gallery_image_reference = gallery_image_reference self.source_uri = source_uri self.source_resource_id = source_resource_id - self.source_unique_id = None + self.source_unique_id: Optional[str] = None self.upload_size_bytes = upload_size_bytes @@ -266,9 +266,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -487,27 +487,27 @@ def __init__( # pylint: disable=too-many-locals :paramtype disk_access_id: str """ super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None - self.managed_by_extended = None + self.managed_by: Optional[str] = None + self.managed_by_extended: Optional[List[str]] = None self.sku = sku self.zones = zones - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.hyper_v_generation = hyper_v_generation self.creation_data = creation_data self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.unique_id = None + self.disk_size_bytes: Optional[int] = None + self.unique_id: Optional[str] = None self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.disk_iops_read_write = disk_iops_read_write self.disk_m_bps_read_write = disk_m_bps_read_write self.disk_iops_read_only = disk_iops_read_only self.disk_m_bps_read_only = disk_m_bps_read_only - self.disk_state = None + self.disk_state: Optional[Union[str, "_models.DiskState"]] = None self.encryption = encryption self.max_shares = max_shares - self.share_info = None + self.share_info: Optional[List["_models.ShareInfoElement"]] = None self.network_access_policy = network_access_policy self.disk_access_id = disk_access_id @@ -571,9 +571,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(location=location, tags=tags, **kwargs) - self.private_endpoint_connections = None - self.provisioning_state = None - self.time_created = None + self.private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None + self.provisioning_state: Optional[str] = None + self.time_created: Optional[datetime.datetime] = None class DiskAccessList(_serialization.Model): @@ -715,8 +715,8 @@ def __init__( self.identity = identity self.encryption_type = encryption_type self.active_key = active_key - self.previous_keys = None - self.provisioning_state = None + self.previous_keys: Optional[List["_models.KeyVaultAndKeyReference"]] = None + self.provisioning_state: Optional[str] = None class DiskEncryptionSetList(_serialization.Model): @@ -863,7 +863,7 @@ def __init__(self, *, name: Optional[Union[str, "_models.DiskStorageAccountTypes """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class DiskUpdate(_serialization.Model): @@ -1089,8 +1089,8 @@ def __init__( """ super().__init__(**kwargs) self.type = type - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None class EncryptionSettingsCollection(_serialization.Model): @@ -1371,7 +1371,7 @@ class PrivateEndpoint(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class PrivateEndpointConnection(_serialization.Model): @@ -1432,12 +1432,12 @@ def __init__( ~azure.mgmt.compute.v2020_05_01.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None class PrivateLinkResource(_serialization.Model): @@ -1482,11 +1482,11 @@ def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: :paramtype required_zone_names: list[str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.group_id = None - self.required_members = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.group_id: Optional[str] = None + self.required_members: Optional[List[str]] = None self.required_zone_names = required_zone_names @@ -1576,7 +1576,7 @@ class ShareInfoElement(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.vm_uri = None + self.vm_uri: Optional[str] = None class Snapshot(Resource): @@ -1733,17 +1733,17 @@ def __init__( :paramtype disk_access_id: str """ super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None + self.managed_by: Optional[str] = None self.sku = sku - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.hyper_v_generation = hyper_v_generation self.creation_data = creation_data self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.unique_id = None + self.disk_size_bytes: Optional[int] = None + self.unique_id: Optional[str] = None self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.incremental = incremental self.encryption = encryption self.network_access_policy = network_access_policy @@ -1814,7 +1814,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class SnapshotUpdate(_serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_operations.py index b43b704fdf40..5623bf12bb4d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +56,7 @@ def build_disks_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -92,7 +90,7 @@ def build_disks_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -125,7 +123,7 @@ def build_disks_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -153,7 +151,7 @@ def build_disks_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -181,7 +179,7 @@ def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -236,7 +234,7 @@ def build_disks_grant_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -266,7 +264,7 @@ def build_disks_revoke_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -295,7 +293,7 @@ def build_snapshots_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -329,7 +327,7 @@ def build_snapshots_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -362,7 +360,7 @@ def build_snapshots_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -390,7 +388,7 @@ def build_snapshots_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -418,7 +416,7 @@ def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -473,7 +471,7 @@ def build_snapshots_grant_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -503,7 +501,7 @@ def build_snapshots_revoke_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -532,7 +530,7 @@ def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -566,7 +564,7 @@ def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -599,7 +597,7 @@ def build_disk_encryption_sets_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -630,7 +628,7 @@ def build_disk_encryption_sets_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -661,7 +659,7 @@ def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -716,7 +714,7 @@ def build_disk_accesses_create_or_update_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -750,7 +748,7 @@ def build_disk_accesses_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -783,7 +781,7 @@ def build_disk_accesses_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -814,7 +812,7 @@ def build_disk_accesses_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -845,7 +843,7 @@ def build_disk_accesses_list_by_resource_group_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -899,7 +897,7 @@ def build_disk_accesses_get_private_link_resources_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -931,10 +929,10 @@ class DisksOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -1929,10 +1927,10 @@ class SnapshotsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -2937,10 +2935,10 @@ class DiskEncryptionSetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -3666,10 +3664,10 @@ class DiskAccessesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py index eb3a7a5bba5a..ad0cafb9a4a8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -114,7 +116,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-06-01". Note that overriding this default value may result in unsupported behavior. @@ -124,15 +126,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -151,7 +155,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_metadata.json index 4ad38d5dadb0..1815fe3aa180 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_compute_management_client.py index 5f60cb47786a..0f4605d9514e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -116,7 +118,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-06-01". Note that overriding this default value may result in unsupported behavior. @@ -126,15 +128,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -153,7 +157,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py index cfbef6a14027..7676df9a1b47 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import ( Any, AsyncIterable, @@ -25,6 +25,7 @@ ) import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -46,6 +47,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_availability_sets_create_or_update_request, build_availability_sets_delete_request, @@ -191,11 +193,8 @@ build_virtual_machines_start_request, build_virtual_machines_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -214,10 +213,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -310,10 +309,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -932,10 +931,10 @@ class ProximityPlacementGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -1484,10 +1483,10 @@ class DedicatedHostGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2038,10 +2037,10 @@ class DedicatedHostsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2728,10 +2727,10 @@ class SshPublicKeysOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3327,10 +3326,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3542,10 +3541,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -4220,10 +4219,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4553,10 +4552,10 @@ class UsageOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4652,10 +4651,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7292,10 +7291,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7392,10 +7391,10 @@ class ImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -8088,10 +8087,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -9322,7 +9321,6 @@ async def get_next(next_link=None): def get_os_upgrade_history( self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncIterable["_models.UpgradeOperationHistoricalStatusInfo"]: - # pylint: disable=line-too-long """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. Required. @@ -11348,10 +11346,10 @@ class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -12053,10 +12051,10 @@ class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-t def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _cancel_initial( @@ -12446,10 +12444,10 @@ class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too- def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -13162,10 +13160,10 @@ class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-me def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _reimage_initial( @@ -15051,10 +15049,10 @@ class LogAnalyticsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _export_request_rate_by_interval_initial( @@ -15425,10 +15423,10 @@ class VirtualMachineRunCommandsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -16262,10 +16260,10 @@ class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py index 8831e0a433c9..5a139c6c0094 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AdditionalCapabilities(_serialization.Model): @@ -225,7 +220,7 @@ class AutomaticOSUpgradePolicy(_serialization.Model): applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. :code:`
    `\\ :code:`
    ` If this is set to true for Windows based scale sets, `enableAutomaticUpdates - `_ # pylint: disable=line-too-long + `_ is automatically set to false and cannot be set to true. :vartype enable_automatic_os_upgrade: bool :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default @@ -250,7 +245,7 @@ def __init__( applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. :code:`
    `\\ :code:`
    ` If this is set to true for Windows based scale sets, `enableAutomaticUpdates - `_ # pylint: disable=line-too-long + `_ is automatically set to false and cannot be set to true. :paramtype enable_automatic_os_upgrade: bool :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. @@ -368,9 +363,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -482,7 +477,7 @@ def __init__( self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines self.proximity_placement_group = proximity_placement_group - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None class AvailabilitySetListResult(_serialization.Model): @@ -613,7 +608,7 @@ def __init__( self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines self.proximity_placement_group = proximity_placement_group - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None class AvailablePatchSummary(_serialization.Model): @@ -672,14 +667,14 @@ class AvailablePatchSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None - self.assessment_activity_id = None - self.reboot_pending = None - self.critical_and_security_patch_count = None - self.other_patch_count = None - self.start_time = None - self.last_modified_time = None - self.error = None + self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None + self.assessment_activity_id: Optional[str] = None + self.reboot_pending: Optional[bool] = None + self.critical_and_security_patch_count: Optional[int] = None + self.other_patch_count: Optional[int] = None + self.start_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.error: Optional["_models.ApiError"] = None class BillingProfile(_serialization.Model): @@ -791,9 +786,9 @@ class BootDiagnosticsInstanceView(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None - self.status = None + self.console_screenshot_blob_uri: Optional[str] = None + self.serial_console_log_blob_uri: Optional[str] = None + self.status: Optional["_models.InstanceViewStatus"] = None class ComputeOperationListResult(_serialization.Model): @@ -816,7 +811,7 @@ class ComputeOperationListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None + self.value: Optional[List["_models.ComputeOperationValue"]] = None class ComputeOperationValue(_serialization.Model): @@ -859,12 +854,12 @@ class ComputeOperationValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.origin = None - self.name = None - self.operation = None - self.resource = None - self.description = None - self.provider = None + self.origin: Optional[str] = None + self.name: Optional[str] = None + self.operation: Optional[str] = None + self.resource: Optional[str] = None + self.description: Optional[str] = None + self.provider: Optional[str] = None class DataDisk(_serialization.Model): @@ -1010,8 +1005,8 @@ def __init__( self.disk_size_gb = disk_size_gb self.managed_disk = managed_disk self.to_be_detached = to_be_detached - self.disk_iops_read_write = None - self.disk_m_bps_read_write = None + self.disk_iops_read_write: Optional[int] = None + self.disk_m_bps_read_write: Optional[int] = None class DataDiskImage(_serialization.Model): @@ -1035,7 +1030,7 @@ class DataDiskImage(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.lun = None + self.lun: Optional[int] = None class DedicatedHost(Resource): @@ -1150,12 +1145,12 @@ def __init__( self.sku = sku self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure - self.host_id = None - self.virtual_machines = None + self.host_id: Optional[str] = None + self.virtual_machines: Optional[List["_models.SubResourceReadOnly"]] = None self.license_type = license_type - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.DedicatedHostInstanceView"] = None class DedicatedHostAllocatableVM(_serialization.Model): @@ -1305,8 +1300,8 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count - self.hosts = None - self.instance_view = None + self.hosts: Optional[List["_models.SubResourceReadOnly"]] = None + self.instance_view: Optional["_models.DedicatedHostGroupInstanceView"] = None self.support_automatic_placement = support_automatic_placement @@ -1439,8 +1434,8 @@ def __init__( super().__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count - self.hosts = None - self.instance_view = None + self.hosts: Optional[List["_models.SubResourceReadOnly"]] = None + self.instance_view: Optional["_models.DedicatedHostGroupInstanceView"] = None self.support_automatic_placement = support_automatic_placement @@ -1484,7 +1479,7 @@ def __init__( :paramtype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.asset_id = None + self.asset_id: Optional[str] = None self.available_capacity = available_capacity self.statuses = statuses @@ -1534,7 +1529,7 @@ def __init__( :paramtype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] """ super().__init__(available_capacity=available_capacity, statuses=statuses, **kwargs) - self.name = None + self.name: Optional[str] = None class DedicatedHostListResult(_serialization.Model): @@ -1653,12 +1648,12 @@ def __init__( super().__init__(tags=tags, **kwargs) self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure - self.host_id = None - self.virtual_machines = None + self.host_id: Optional[str] = None + self.virtual_machines: Optional[List["_models.SubResourceReadOnly"]] = None self.license_type = license_type - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.DedicatedHostInstanceView"] = None class DiagnosticsProfile(_serialization.Model): @@ -2071,7 +2066,7 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.hyper_v_generation = hyper_v_generation @@ -2499,7 +2494,7 @@ def __init__( self.offer = offer self.sku = sku self.version = version - self.exact_version = None + self.exact_version: Optional[str] = None class ImageStorageProfile(_serialization.Model): @@ -2508,12 +2503,12 @@ class ImageStorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2020_06_01.models.ImageOSDisk :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2020_06_01.models.ImageDataDisk] :ivar zone_resilient: Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). @@ -2538,12 +2533,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2020_06_01.models.ImageOSDisk :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2020_06_01.models.ImageDataDisk] :keyword zone_resilient: Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). @@ -2610,7 +2605,7 @@ def __init__( super().__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.hyper_v_generation = hyper_v_generation @@ -2843,19 +2838,19 @@ class LastPatchInstallationSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None - self.installation_activity_id = None - self.maintenance_window_exceeded = None - self.reboot_status = None - self.not_selected_patch_count = None - self.excluded_patch_count = None - self.pending_patch_count = None - self.installed_patch_count = None - self.failed_patch_count = None - self.start_time = None - self.last_modified_time = None - self.started_by = None - self.error = None + self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None + self.installation_activity_id: Optional[str] = None + self.maintenance_window_exceeded: Optional[bool] = None + self.reboot_status: Optional[Union[str, "_models.RebootStatus"]] = None + self.not_selected_patch_count: Optional[int] = None + self.excluded_patch_count: Optional[int] = None + self.pending_patch_count: Optional[int] = None + self.installed_patch_count: Optional[int] = None + self.failed_patch_count: Optional[int] = None + self.start_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.started_by: Optional[str] = None + self.error: Optional["_models.ApiError"] = None class LinuxConfiguration(_serialization.Model): @@ -3049,7 +3044,7 @@ class LogAnalyticsOperationResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.properties = None + self.properties: Optional["_models.LogAnalyticsOutput"] = None class LogAnalyticsOutput(_serialization.Model): @@ -3072,7 +3067,7 @@ class LogAnalyticsOutput(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.output = None + self.output: Optional[str] = None class MaintenanceRedeployStatus(_serialization.Model): @@ -3324,8 +3319,8 @@ class OrchestrationServiceSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.service_name = None - self.service_state = None + self.service_name: Optional[Union[str, "_models.OrchestrationServiceNames"]] = None + self.service_state: Optional[Union[str, "_models.OrchestrationServiceState"]] = None class OSDisk(_serialization.Model): @@ -3509,7 +3504,7 @@ class OSProfile(_serialization.Model): **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :vartype computer_name: str :ivar admin_username: Specifies the name of the administrator account. :code:`
    `\\ :code:`
    ` This property cannot be updated after the VM is created. :code:`
    `\\ @@ -3522,10 +3517,10 @@ class OSProfile(_serialization.Model): :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -3538,10 +3533,10 @@ class OSProfile(_serialization.Model): "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :vartype admin_password: str :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum @@ -3552,7 +3547,7 @@ class OSProfile(_serialization.Model): `_ :code:`
    `\\ :code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :vartype custom_data: str :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -3560,10 +3555,10 @@ class OSProfile(_serialization.Model): :ivar linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :vartype linux_configuration: ~azure.mgmt.compute.v2020_06_01.models.LinuxConfiguration :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. :vartype secrets: list[~azure.mgmt.compute.v2020_06_01.models.VaultSecretGroup] @@ -3609,7 +3604,7 @@ def __init__( **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :paramtype computer_name: str :keyword admin_username: Specifies the name of the administrator account. :code:`
    `\\ :code:`
    ` This property cannot be updated after the VM is created. :code:`
    `\\ @@ -3622,10 +3617,10 @@ def __init__( :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -3638,10 +3633,10 @@ def __init__( "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :paramtype admin_password: str :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum @@ -3652,7 +3647,7 @@ def __init__( `_ :code:`
    `\\ :code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :paramtype custom_data: str :keyword windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -3660,10 +3655,10 @@ def __init__( :keyword linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :paramtype linux_configuration: ~azure.mgmt.compute.v2020_06_01.models.LinuxConfiguration :keyword secrets: Specifies set of certificates that should be installed onto the virtual machine. @@ -3869,9 +3864,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type - self.virtual_machines = None - self.virtual_machine_scale_sets = None - self.availability_sets = None + self.virtual_machines: Optional[List["_models.SubResourceWithColocationStatus"]] = None + self.virtual_machine_scale_sets: Optional[List["_models.SubResourceWithColocationStatus"]] = None + self.availability_sets: Optional[List["_models.SubResourceWithColocationStatus"]] = None self.colocation_status = colocation_status @@ -3984,8 +3979,8 @@ class RecoveryWalkResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.walk_performed = None - self.next_platform_update_domain = None + self.walk_performed: Optional[bool] = None + self.next_platform_update_domain: Optional[int] = None class RequestRateByIntervalInput(LogAnalyticsInputBase): @@ -4108,8 +4103,8 @@ class RetrieveBootDiagnosticsDataResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None + self.console_screenshot_blob_uri: Optional[str] = None + self.serial_console_log_blob_uri: Optional[str] = None class RollbackStatusInfo(_serialization.Model): @@ -4141,9 +4136,9 @@ class RollbackStatusInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successfully_rolledback_instance_count = None - self.failed_rolledback_instance_count = None - self.rollback_error = None + self.successfully_rolledback_instance_count: Optional[int] = None + self.failed_rolledback_instance_count: Optional[int] = None + self.rollback_error: Optional["_models.ApiError"] = None class RollingUpgradePolicy(_serialization.Model): @@ -4255,10 +4250,10 @@ class RollingUpgradeProgressInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successful_instance_count = None - self.failed_instance_count = None - self.in_progress_instance_count = None - self.pending_instance_count = None + self.successful_instance_count: Optional[int] = None + self.failed_instance_count: Optional[int] = None + self.in_progress_instance_count: Optional[int] = None + self.pending_instance_count: Optional[int] = None class RollingUpgradeRunningStatus(_serialization.Model): @@ -4295,10 +4290,10 @@ class RollingUpgradeRunningStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.last_action = None - self.last_action_time = None + self.code: Optional[Union[str, "_models.RollingUpgradeStatusCode"]] = None + self.start_time: Optional[datetime.datetime] = None + self.last_action: Optional[Union[str, "_models.RollingUpgradeActionType"]] = None + self.last_action_time: Optional[datetime.datetime] = None class RollingUpgradeStatusInfo(Resource): @@ -4360,10 +4355,10 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(location=location, tags=tags, **kwargs) - self.policy = None - self.running_status = None - self.progress = None - self.error = None + self.policy: Optional["_models.RollingUpgradePolicy"] = None + self.running_status: Optional["_models.RollingUpgradeRunningStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None class RunCommandDocumentBase(_serialization.Model): @@ -4864,7 +4859,7 @@ class SshPublicKey(_serialization.Model): :ivar key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `\\ :code:`
    ` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. # pylint: disable=line-too-long + `_. :vartype key_data: str """ @@ -4882,7 +4877,7 @@ def __init__(self, *, path: Optional[str] = None, key_data: Optional[str] = None :keyword key_data: SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `\\ :code:`
    ` For creating ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure - `_. # pylint: disable=line-too-long + `_. :paramtype key_data: str """ super().__init__(**kwargs) @@ -4903,7 +4898,7 @@ class SshPublicKeyGenerateKeyPairResult(_serialization.Model): through ssh. The public key is in ssh-rsa format. Required. :vartype public_key: str :ivar id: The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. Required. :vartype id: str """ @@ -4932,7 +4927,7 @@ def __init__( machine through ssh. The public key is in ssh-rsa format. Required. :paramtype public_key: str :keyword id: The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. Required. :paramtype id: str """ @@ -5080,12 +5075,12 @@ class StorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2020_06_01.models.OSDisk :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2020_06_01.models.DataDisk] """ @@ -5112,12 +5107,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2020_06_01.models.OSDisk :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual machine. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2020_06_01.models.DataDisk] """ super().__init__(**kwargs) @@ -5146,7 +5141,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class SubResourceWithColocationStatus(SubResource): @@ -5270,9 +5265,9 @@ class UpgradeOperationHistoricalStatusInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.properties = None - self.type = None - self.location = None + self.properties: Optional["_models.UpgradeOperationHistoricalStatusInfoProperties"] = None + self.type: Optional[str] = None + self.location: Optional[str] = None class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # pylint: disable=name-too-long @@ -5316,12 +5311,12 @@ class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # p def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.running_status = None - self.progress = None - self.error = None - self.started_by = None - self.target_image_reference = None - self.rollback_info = None + self.running_status: Optional["_models.UpgradeOperationHistoryStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None + self.started_by: Optional[Union[str, "_models.UpgradeOperationInvoker"]] = None + self.target_image_reference: Optional["_models.ImageReference"] = None + self.rollback_info: Optional["_models.RollbackStatusInfo"] = None class UpgradeOperationHistoryStatus(_serialization.Model): @@ -5353,9 +5348,9 @@ class UpgradeOperationHistoryStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.end_time = None + self.code: Optional[Union[str, "_models.UpgradeState"]] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None class UpgradePolicy(_serialization.Model): @@ -5512,8 +5507,8 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class VaultCertificate(_serialization.Model): @@ -5674,10 +5669,10 @@ class VirtualMachine(Resource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. @@ -5851,10 +5846,10 @@ def __init__( # pylint: disable=too-many-locals machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. @@ -5914,7 +5909,7 @@ def __init__( # pylint: disable=too-many-locals """ super().__init__(location=location, tags=tags, **kwargs) self.plan = plan - self.resources = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None self.identity = identity self.zones = zones self.hardware_profile = hardware_profile @@ -5932,10 +5927,10 @@ def __init__( # pylint: disable=too-many-locals self.billing_profile = billing_profile self.host = host self.host_group = host_group - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None self.extensions_time_budget = extensions_time_budget @@ -6037,14 +6032,14 @@ class VirtualMachineAssessPatchesResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None - self.assessment_activity_id = None - self.reboot_pending = None - self.critical_and_security_patch_count = None - self.other_patch_count = None - self.start_date_time = None - self.patches = None - self.error = None + self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None + self.assessment_activity_id: Optional[str] = None + self.reboot_pending: Optional[bool] = None + self.critical_and_security_patch_count: Optional[int] = None + self.other_patch_count: Optional[int] = None + self.start_date_time: Optional[datetime.datetime] = None + self.patches: Optional[List["_models.VirtualMachineSoftwarePatchProperties"]] = None + self.error: Optional["_models.ApiError"] = None class VirtualMachineCaptureParameters(_serialization.Model): @@ -6129,10 +6124,10 @@ def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylin :paramtype id: str """ super().__init__(id=id, **kwargs) - self.schema = None - self.content_version = None - self.parameters = None - self.resources = None + self.schema: Optional[str] = None + self.content_version: Optional[str] = None + self.parameters: Optional[JSON] = None + self.resources: Optional[List[JSON]] = None class VirtualMachineExtension(Resource): @@ -6263,7 +6258,7 @@ def __init__( self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.instance_view = instance_view @@ -6580,7 +6575,7 @@ class VirtualMachineHealthStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None + self.status: Optional["_models.InstanceViewStatus"] = None class VirtualMachineIdentity(_serialization.Model): @@ -6601,7 +6596,7 @@ class VirtualMachineIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.compute.v2020_06_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2020_06_01.models.UserAssignedIdentitiesValue] """ @@ -6633,13 +6628,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.compute.v2020_06_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2020_06_01.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -6948,9 +6943,9 @@ def __init__( self.maintenance_redeploy_status = maintenance_redeploy_status self.disks = disks self.extensions = extensions - self.vm_health = None + self.vm_health: Optional["_models.VirtualMachineHealthStatus"] = None self.boot_diagnostics = boot_diagnostics - self.assigned_host = None + self.assigned_host: Optional[str] = None self.statuses = statuses self.patch_status = patch_status @@ -7186,8 +7181,8 @@ def __init__( self.timeout_in_seconds = timeout_in_seconds self.output_blob_uri = output_blob_uri self.error_blob_uri = error_blob_uri - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineRunCommandInstanceView"] = None class VirtualMachineRunCommandInstanceView(_serialization.Model): @@ -7448,8 +7443,8 @@ def __init__( self.timeout_in_seconds = timeout_in_seconds self.output_blob_uri = output_blob_uri self.error_blob_uri = error_blob_uri - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineRunCommandInstanceView"] = None class VirtualMachineScaleSet(Resource): @@ -7657,10 +7652,10 @@ def __init__( self.upgrade_policy = upgrade_policy self.automatic_repairs_policy = automatic_repairs_policy self.virtual_machine_profile = virtual_machine_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.overprovision = overprovision self.do_not_run_extensions_on_overprovisioned_v_ms = do_not_run_extensions_on_overprovisioned_v_ms - self.unique_id = None + self.unique_id: Optional[str] = None self.single_placement_group = single_placement_group self.zone_balance = zone_balance self.platform_fault_domain_count = platform_fault_domain_count @@ -7896,7 +7891,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.type = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -7905,7 +7900,7 @@ def __init__( self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.provision_after_extensions = provision_after_extensions @@ -8090,8 +8085,8 @@ def __init__( :paramtype provision_after_extensions: list[str] """ super().__init__(**kwargs) - self.name = None - self.type = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -8100,7 +8095,7 @@ def __init__( self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.provision_after_extensions = provision_after_extensions @@ -8123,7 +8118,7 @@ class VirtualMachineScaleSetIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.compute.v2020_06_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -8162,13 +8157,13 @@ def __init__( :keyword user_assigned_identities: The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -8197,8 +8192,8 @@ class VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue(_serialization.M def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class VirtualMachineScaleSetInstanceView(_serialization.Model): @@ -8238,10 +8233,10 @@ def __init__(self, *, statuses: Optional[List["_models.InstanceViewStatus"]] = N :paramtype statuses: list[~azure.mgmt.compute.v2020_06_01.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.virtual_machine = None - self.extensions = None + self.virtual_machine: Optional["_models.VirtualMachineScaleSetInstanceViewStatusesSummary"] = None + self.extensions: Optional[List["_models.VirtualMachineScaleSetVMExtensionsSummary"]] = None self.statuses = statuses - self.orchestration_services = None + self.orchestration_services: Optional[List["_models.OrchestrationServiceSummary"]] = None class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): # pylint: disable=name-too-long @@ -8265,7 +8260,7 @@ class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.statuses_summary = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetIPConfiguration(SubResource): @@ -8740,7 +8735,7 @@ class VirtualMachineScaleSetNetworkProfile(_serialization.Model): :ivar health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :vartype health_probe: ~azure.mgmt.compute.v2020_06_01.models.ApiEntityReference :ivar network_interface_configurations: The list of network configurations. :vartype network_interface_configurations: @@ -8765,7 +8760,7 @@ def __init__( """ :keyword health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :paramtype health_probe: ~azure.mgmt.compute.v2020_06_01.models.ApiEntityReference :keyword network_interface_configurations: The list of network configurations. :paramtype network_interface_configurations: @@ -8922,10 +8917,10 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :vartype admin_username: str :ivar admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -8938,16 +8933,16 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :vartype admin_password: str :ivar custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :vartype custom_data: str :ivar windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -8955,10 +8950,10 @@ class VirtualMachineScaleSetOSProfile(_serialization.Model): :ivar linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :vartype linux_configuration: ~azure.mgmt.compute.v2020_06_01.models.LinuxConfiguration :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines in the scale set. @@ -9001,10 +8996,10 @@ def __init__( :code:`
    `\\ :code:`
    ` **Max-length (Windows):** 20 characters :code:`
    `\\ :code:`
    `\\ :code:`
  • ` For root access to the Linux VM, see `Using root privileges on Linux virtual machines in Azure - `_\\ # pylint: disable=line-too-long + `_\\ :code:`
    `\\ :code:`
  • ` For a list of built-in system users on Linux that should not be used in this field, see `Selecting User Names for Linux on Azure - `_. # pylint: disable=line-too-long + `_. :paramtype admin_username: str :keyword admin_password: Specifies the password of the administrator account. :code:`
    `\\ :code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `\\ :code:`
    ` @@ -9017,16 +9012,16 @@ def __init__( "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `\\ :code:`
    ` For resetting the password, see `How to reset the Remote Desktop service or its login password in a Windows VM - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension - `_. # pylint: disable=line-too-long + `_. :paramtype admin_password: str :keyword custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. :code:`
    `\\ :code:`
    ` For using cloud-init for your VM, see `Using cloud-init to customize a Linux VM during creation - `_. # pylint: disable=line-too-long + `_. :paramtype custom_data: str :keyword windows_configuration: Specifies Windows operating system settings on the virtual machine. @@ -9034,10 +9029,10 @@ def __init__( :keyword linux_configuration: Specifies the Linux operating system settings on the virtual machine. :code:`
    `\\ :code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions - `_. # pylint: disable=line-too-long + `_. :paramtype linux_configuration: ~azure.mgmt.compute.v2020_06_01.models.LinuxConfiguration :keyword secrets: Specifies set of certificates that should be installed onto the virtual machines in the scale set. @@ -9230,9 +9225,9 @@ class VirtualMachineScaleSetSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.resource_type = None - self.sku = None - self.capacity = None + self.resource_type: Optional[str] = None + self.sku: Optional["_models.Sku"] = None + self.capacity: Optional["_models.VirtualMachineScaleSetSkuCapacity"] = None class VirtualMachineScaleSetSkuCapacity(_serialization.Model): @@ -9269,10 +9264,10 @@ class VirtualMachineScaleSetSkuCapacity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default_capacity = None - self.scale_type = None + self.minimum: Optional[int] = None + self.maximum: Optional[int] = None + self.default_capacity: Optional[int] = None + self.scale_type: Optional[Union[str, "_models.VirtualMachineScaleSetSkuScaleType"]] = None class VirtualMachineScaleSetStorageProfile(_serialization.Model): @@ -9286,12 +9281,12 @@ class VirtualMachineScaleSetStorageProfile(_serialization.Model): :ivar os_disk: Specifies information about the operating system disk used by the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype os_disk: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetOSDisk :ivar data_disks: Specifies the parameters that are used to add data disks to the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :vartype data_disks: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetDataDisk] """ @@ -9319,12 +9314,12 @@ def __init__( :keyword os_disk: Specifies information about the operating system disk used by the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype os_disk: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetOSDisk :keyword data_disks: Specifies the parameters that are used to add data disks to the virtual machines in the scale set. :code:`
    `\\ :code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines - `_. # pylint: disable=line-too-long + `_. :paramtype data_disks: list[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetDataDisk] """ @@ -9691,7 +9686,7 @@ class VirtualMachineScaleSetUpdateNetworkProfile(_serialization.Model): # pylin :ivar health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :vartype health_probe: ~azure.mgmt.compute.v2020_06_01.models.ApiEntityReference :ivar network_interface_configurations: The list of network configurations. :vartype network_interface_configurations: @@ -9718,7 +9713,7 @@ def __init__( """ :keyword health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :paramtype health_probe: ~azure.mgmt.compute.v2020_06_01.models.ApiEntityReference :keyword network_interface_configurations: The list of network configurations. :paramtype network_interface_configurations: @@ -10091,10 +10086,10 @@ class VirtualMachineScaleSetVM(Resource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :vartype availability_set: ~azure.mgmt.compute.v2020_06_01.models.SubResource @@ -10225,10 +10220,10 @@ def __init__( # pylint: disable=too-many-locals machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. :paramtype availability_set: ~azure.mgmt.compute.v2020_06_01.models.SubResource @@ -10249,14 +10244,14 @@ def __init__( # pylint: disable=too-many-locals ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMProtectionPolicy """ super().__init__(location=location, tags=tags, **kwargs) - self.instance_id = None - self.sku = None + self.instance_id: Optional[str] = None + self.sku: Optional["_models.Sku"] = None self.plan = plan - self.resources = None - self.zones = None - self.latest_model_applied = None - self.vm_id = None - self.instance_view = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None + self.zones: Optional[List[str]] = None + self.latest_model_applied: Optional[bool] = None + self.vm_id: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineScaleSetVMInstanceView"] = None self.hardware_profile = hardware_profile self.storage_profile = storage_profile self.additional_capabilities = additional_capabilities @@ -10266,9 +10261,9 @@ def __init__( # pylint: disable=too-many-locals self.network_profile_configuration = network_profile_configuration self.diagnostics_profile = diagnostics_profile self.availability_set = availability_set - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.license_type = license_type - self.model_definition_applied = None + self.model_definition_applied: Optional[str] = None self.protection_policy = protection_policy @@ -10377,8 +10372,8 @@ def __init__( ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtensionInstanceView """ super().__init__(**kwargs) - self.name = None - self.type = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -10387,7 +10382,7 @@ def __init__( self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.instance_view = instance_view @@ -10439,8 +10434,8 @@ class VirtualMachineScaleSetVMExtensionsSummary(_serialization.Model): # pylint def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.statuses_summary = None + self.name: Optional[str] = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): @@ -10536,8 +10531,8 @@ def __init__( :paramtype protected_settings: JSON """ super().__init__(**kwargs) - self.name = None - self.type = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -10709,10 +10704,10 @@ def __init__( self.maintenance_redeploy_status = maintenance_redeploy_status self.disks = disks self.extensions = extensions - self.vm_health = None + self.vm_health: Optional["_models.VirtualMachineHealthStatus"] = None self.boot_diagnostics = boot_diagnostics self.statuses = statuses - self.assigned_host = None + self.assigned_host: Optional[str] = None self.placement_group_id = placement_group_id @@ -11115,16 +11110,16 @@ class VirtualMachineSoftwarePatchProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.patch_id = None - self.name = None - self.version = None - self.kbid = None - self.classifications = None - self.reboot_behavior = None - self.activity_id = None - self.published_date = None - self.last_modified_date_time = None - self.assessment_state = None + self.patch_id: Optional[str] = None + self.name: Optional[str] = None + self.version: Optional[str] = None + self.kbid: Optional[str] = None + self.classifications: Optional[List[str]] = None + self.reboot_behavior: Optional[Union[str, "_models.SoftwareUpdateRebootBehavior"]] = None + self.activity_id: Optional[str] = None + self.published_date: Optional[datetime.datetime] = None + self.last_modified_date_time: Optional[datetime.datetime] = None + self.assessment_state: Optional[Union[str, "_models.PatchAssessmentState"]] = None class VirtualMachineStatusCodeCount(_serialization.Model): @@ -11151,8 +11146,8 @@ class VirtualMachineStatusCodeCount(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.count = None + self.code: Optional[str] = None + self.count: Optional[int] = None class VirtualMachineUpdate(UpdateResource): @@ -11194,10 +11189,10 @@ class VirtualMachineUpdate(UpdateResource): machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. @@ -11358,10 +11353,10 @@ def __init__( # pylint: disable=too-many-locals machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines - `_. # pylint: disable=line-too-long + `_. :code:`
    `\\ :code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure - `_ # pylint: disable=line-too-long + `_ :code:`
    `\\ :code:`
    ` Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. @@ -11438,10 +11433,10 @@ def __init__( # pylint: disable=too-many-locals self.billing_profile = billing_profile self.host = host self.host_group = host_group - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None self.extensions_time_budget = extensions_time_budget diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py index 5b035cf6f9e7..1138ff34911c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +75,7 @@ def build_availability_sets_create_or_update_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -111,7 +109,7 @@ def build_availability_sets_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -141,7 +139,7 @@ def build_availability_sets_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -169,7 +167,7 @@ def build_availability_sets_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -226,7 +224,7 @@ def build_availability_sets_list_request(resource_group_name: str, subscription_ _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -256,7 +254,7 @@ def build_availability_sets_list_available_sizes_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -288,7 +286,7 @@ def build_proximity_placement_groups_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -324,7 +322,7 @@ def build_proximity_placement_groups_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -356,7 +354,7 @@ def build_proximity_placement_groups_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -391,7 +389,7 @@ def build_proximity_placement_groups_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -456,7 +454,7 @@ def build_proximity_placement_groups_list_by_resource_group_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -487,7 +485,7 @@ def build_dedicated_host_groups_create_or_update_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -521,7 +519,7 @@ def build_dedicated_host_groups_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -551,7 +549,7 @@ def build_dedicated_host_groups_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -584,7 +582,7 @@ def build_dedicated_host_groups_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -617,7 +615,7 @@ def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -674,7 +672,7 @@ def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -709,7 +707,7 @@ def build_dedicated_hosts_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -740,7 +738,7 @@ def build_dedicated_hosts_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -775,7 +773,7 @@ def build_dedicated_hosts_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -809,7 +807,7 @@ def build_dedicated_hosts_list_by_host_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -866,7 +864,7 @@ def build_ssh_public_keys_list_by_resource_group_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -897,7 +895,7 @@ def build_ssh_public_keys_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -931,7 +929,7 @@ def build_ssh_public_keys_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -961,7 +959,7 @@ def build_ssh_public_keys_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -989,7 +987,7 @@ def build_ssh_public_keys_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -1020,7 +1018,7 @@ def build_ssh_public_keys_generate_key_pair_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -1051,7 +1049,7 @@ def build_virtual_machine_extension_images_get_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1084,7 +1082,7 @@ def build_virtual_machine_extension_images_list_types_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1123,7 +1121,7 @@ def build_virtual_machine_extension_images_list_versions_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1162,7 +1160,7 @@ def build_virtual_machine_extensions_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1197,7 +1195,7 @@ def build_virtual_machine_extensions_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1228,7 +1226,7 @@ def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1263,7 +1261,7 @@ def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1297,7 +1295,7 @@ def build_virtual_machine_extensions_list_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1330,7 +1328,7 @@ def build_virtual_machine_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1373,7 +1371,7 @@ def build_virtual_machine_images_list_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1412,7 +1410,7 @@ def build_virtual_machine_images_list_offers_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1442,7 +1440,7 @@ def build_virtual_machine_images_list_publishers_request( # pylint: disable=nam # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1472,7 +1470,7 @@ def build_virtual_machine_images_list_skus_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1501,7 +1499,7 @@ def build_usage_list_request(location: str, subscription_id: str, **kwargs: Any) # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1531,7 +1529,7 @@ def build_virtual_machines_list_by_location_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1562,7 +1560,7 @@ def build_virtual_machines_capture_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1596,7 +1594,7 @@ def build_virtual_machines_create_or_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1630,7 +1628,7 @@ def build_virtual_machines_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1665,7 +1663,7 @@ def build_virtual_machines_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1700,7 +1698,7 @@ def build_virtual_machines_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1733,7 +1731,7 @@ def build_virtual_machines_instance_view_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1761,7 +1759,7 @@ def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1786,7 +1784,7 @@ def build_virtual_machines_deallocate_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1811,7 +1809,7 @@ def build_virtual_machines_generalize_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1837,7 +1835,7 @@ def build_virtual_machines_list_request(resource_group_name: str, subscription_i _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1895,7 +1893,7 @@ def build_virtual_machines_list_available_sizes_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1923,7 +1921,7 @@ def build_virtual_machines_power_off_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1953,7 +1951,7 @@ def build_virtual_machines_reapply_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1981,7 +1979,7 @@ def build_virtual_machines_restart_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2006,7 +2004,7 @@ def build_virtual_machines_start_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2031,7 +2029,7 @@ def build_virtual_machines_redeploy_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2058,7 +2056,7 @@ def build_virtual_machines_reimage_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2095,7 +2093,7 @@ def build_virtual_machines_retrieve_boot_diagnostics_data_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2127,7 +2125,7 @@ def build_virtual_machines_perform_maintenance_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2152,7 +2150,7 @@ def build_virtual_machines_simulate_eviction_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2180,7 +2178,7 @@ def build_virtual_machines_assess_patches_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2212,7 +2210,7 @@ def build_virtual_machines_run_command_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2242,7 +2240,7 @@ def build_virtual_machine_sizes_list_request(location: str, subscription_id: str # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2273,7 +2271,7 @@ def build_images_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -2307,7 +2305,7 @@ def build_images_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -2337,7 +2335,7 @@ def build_images_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -2365,7 +2363,7 @@ def build_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -2398,7 +2396,7 @@ def build_images_list_by_resource_group_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2453,7 +2451,7 @@ def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2487,7 +2485,7 @@ def build_virtual_machine_scale_sets_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2517,7 +2515,7 @@ def build_virtual_machine_scale_sets_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2545,7 +2543,7 @@ def build_virtual_machine_scale_sets_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2575,7 +2573,7 @@ def build_virtual_machine_scale_sets_deallocate_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2606,7 +2604,7 @@ def build_virtual_machine_scale_sets_delete_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2638,7 +2636,7 @@ def build_virtual_machine_scale_sets_get_instance_view_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2669,7 +2667,7 @@ def build_virtual_machine_scale_sets_list_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2727,7 +2725,7 @@ def build_virtual_machine_scale_sets_list_skus_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2758,7 +2756,7 @@ def build_virtual_machine_scale_sets_get_os_upgrade_history_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2793,7 +2791,7 @@ def build_virtual_machine_scale_sets_power_off_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2826,7 +2824,7 @@ def build_virtual_machine_scale_sets_restart_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2857,7 +2855,7 @@ def build_virtual_machine_scale_sets_start_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2888,7 +2886,7 @@ def build_virtual_machine_scale_sets_redeploy_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2919,7 +2917,7 @@ def build_virtual_machine_scale_sets_perform_maintenance_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2950,7 +2948,7 @@ def build_virtual_machine_scale_sets_update_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2981,7 +2979,7 @@ def build_virtual_machine_scale_sets_reimage_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3012,7 +3010,7 @@ def build_virtual_machine_scale_sets_reimage_all_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3049,7 +3047,7 @@ def build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_upda _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3080,7 +3078,7 @@ def build_virtual_machine_scale_sets_convert_to_single_placement_group_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3111,7 +3109,7 @@ def build_virtual_machine_scale_sets_set_orchestration_service_state_request( # _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3144,7 +3142,7 @@ def build_virtual_machine_scale_set_extensions_create_or_update_request( # pyli _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3179,7 +3177,7 @@ def build_virtual_machine_scale_set_extensions_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3210,7 +3208,7 @@ def build_virtual_machine_scale_set_extensions_delete_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3245,7 +3243,7 @@ def build_virtual_machine_scale_set_extensions_get_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3279,7 +3277,7 @@ def build_virtual_machine_scale_set_extensions_list_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3307,7 +3305,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_cancel_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3332,7 +3330,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3357,7 +3355,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_req _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3385,7 +3383,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( # pyli _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3422,7 +3420,7 @@ def build_virtual_machine_scale_set_vm_extensions_create_or_update_request( # p _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3463,7 +3461,7 @@ def build_virtual_machine_scale_set_vm_extensions_update_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3503,7 +3501,7 @@ def build_virtual_machine_scale_set_vm_extensions_delete_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3543,7 +3541,7 @@ def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3584,7 +3582,7 @@ def build_virtual_machine_scale_set_vm_extensions_list_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3617,7 +3615,7 @@ def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3647,7 +3645,7 @@ def build_virtual_machine_scale_set_vms_reimage_all_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3673,7 +3671,7 @@ def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3703,7 +3701,7 @@ def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3734,7 +3732,7 @@ def build_virtual_machine_scale_set_vms_delete_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3769,7 +3767,7 @@ def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3803,7 +3801,7 @@ def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3842,7 +3840,7 @@ def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "virtualMachineScaleSetName": _SERIALIZER.url( @@ -3884,7 +3882,7 @@ def build_virtual_machine_scale_set_vms_power_off_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3912,7 +3910,7 @@ def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3938,7 +3936,7 @@ def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3964,7 +3962,7 @@ def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3999,7 +3997,7 @@ def build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4032,7 +4030,7 @@ def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4058,7 +4056,7 @@ def build_virtual_machine_scale_set_vms_simulate_eviction_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4088,7 +4086,7 @@ def build_virtual_machine_scale_set_vms_run_command_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4123,7 +4121,7 @@ def build_log_analytics_export_request_rate_by_interval_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -4156,7 +4154,7 @@ def build_log_analytics_export_throttled_requests_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -4187,7 +4185,7 @@ def build_virtual_machine_run_commands_list_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -4217,7 +4215,7 @@ def build_virtual_machine_run_commands_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "commandId": _SERIALIZER.url("command_id", command_id, "str"), @@ -4249,7 +4247,7 @@ def build_virtual_machine_run_commands_create_or_update_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -4284,7 +4282,7 @@ def build_virtual_machine_run_commands_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -4318,7 +4316,7 @@ def build_virtual_machine_run_commands_delete_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -4356,7 +4354,7 @@ def build_virtual_machine_run_commands_get_by_virtual_machine_request( # pylint _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -4390,7 +4388,7 @@ def build_virtual_machine_run_commands_list_by_virtual_machine_request( # pylin _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -4429,7 +4427,7 @@ def build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( # _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4470,7 +4468,7 @@ def build_virtual_machine_scale_set_vm_run_commands_update_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4510,7 +4508,7 @@ def build_virtual_machine_scale_set_vm_run_commands_delete_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4550,7 +4548,7 @@ def build_virtual_machine_scale_set_vm_run_commands_get_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4591,7 +4589,7 @@ def build_virtual_machine_scale_set_vm_run_commands_list_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4626,10 +4624,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4722,10 +4720,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -5343,10 +5341,10 @@ class ProximityPlacementGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -5897,10 +5895,10 @@ class DedicatedHostGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -6449,10 +6447,10 @@ class DedicatedHostsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -7132,10 +7130,10 @@ class SshPublicKeysOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7731,10 +7729,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7946,10 +7944,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -8624,10 +8622,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8957,10 +8955,10 @@ class UsageOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9056,10 +9054,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11679,10 +11677,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11778,10 +11776,10 @@ class ImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -12474,10 +12472,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -15727,10 +15725,10 @@ class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -16432,10 +16430,10 @@ class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-t def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -16821,10 +16819,10 @@ class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too- def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -17537,10 +17535,10 @@ class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-me def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _reimage_initial( @@ -19423,10 +19421,10 @@ class LogAnalyticsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _export_request_rate_by_interval_initial( @@ -19795,10 +19793,10 @@ class VirtualMachineRunCommandsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -20632,10 +20630,10 @@ class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_compute_management_client.py index 893ea61686ba..5f7a56612ed3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -181,7 +183,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-07-01". Note that overriding this default value may result in unsupported behavior. @@ -191,15 +193,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -218,7 +222,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_metadata.json index 086d8054075b..79531de08aae 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_compute_management_client.py index 05616bbced51..be7b3023ef11 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -184,7 +186,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-07-01". Note that overriding this default value may result in unsupported behavior. @@ -194,15 +196,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -221,7 +225,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py index 48f22e6dd1f7..d42235bdcbaf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_availability_sets_create_or_update_request, build_availability_sets_delete_request, @@ -241,11 +243,8 @@ build_virtual_machines_start_request, build_virtual_machines_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -264,10 +263,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -360,10 +359,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -982,10 +981,10 @@ class ProximityPlacementGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -1534,10 +1533,10 @@ class DedicatedHostGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2089,10 +2088,10 @@ class DedicatedHostsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2780,10 +2779,10 @@ class SshPublicKeysOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3379,10 +3378,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3594,10 +3593,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -4272,10 +4271,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4605,10 +4604,10 @@ class VirtualMachineImagesEdgeZoneOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4960,10 +4959,10 @@ class UsageOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5059,10 +5058,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7914,10 +7913,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9260,7 +9259,6 @@ async def get_next(next_link=None): def get_os_upgrade_history( self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncIterable["_models.UpgradeOperationHistoricalStatusInfo"]: - # pylint: disable=line-too-long """Gets list of OS upgrades on a VM scale set instance. :param resource_group_name: The name of the resource group. Required. @@ -11286,10 +11284,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11386,10 +11384,10 @@ class ImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -12082,10 +12080,10 @@ class RestorePointCollectionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -12697,10 +12695,10 @@ class RestorePointsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_initial( @@ -13089,10 +13087,10 @@ class CapacityReservationGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -13677,10 +13675,10 @@ class CapacityReservationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -14385,10 +14383,10 @@ class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -15090,10 +15088,10 @@ class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-t def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _cancel_initial( @@ -15483,10 +15481,10 @@ class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too- def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -16199,10 +16197,10 @@ class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-me def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _reimage_initial( @@ -18106,10 +18104,10 @@ class LogAnalyticsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _export_request_rate_by_interval_initial( @@ -18480,10 +18478,10 @@ class VirtualMachineRunCommandsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -19317,10 +19315,10 @@ class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -20055,10 +20053,10 @@ class ResourceSkusOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -20140,7 +20138,8 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -20161,10 +20160,10 @@ class GalleriesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -20882,10 +20881,10 @@ class GalleryImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -21578,10 +21577,10 @@ class GalleryImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -22356,10 +22355,10 @@ class GalleryApplicationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -23064,10 +23063,10 @@ class GalleryApplicationVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -23847,10 +23846,10 @@ class GallerySharingProfileOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _update_initial( @@ -24060,10 +24059,10 @@ class SharedGalleriesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -24219,10 +24218,10 @@ class SharedGalleryImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -24392,10 +24391,10 @@ class SharedGalleryImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -24582,10 +24581,10 @@ class CommunityGalleriesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -24657,10 +24656,10 @@ class CommunityGalleryImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -24737,10 +24736,10 @@ class CommunityGalleryImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/__init__.py index 413fb4402887..03e61dff7b9b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/__init__.py @@ -69,6 +69,9 @@ DiskImageEncryption, DiskInstanceView, EncryptionImages, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, ExtendedLocation, Gallery, GalleryApplication, @@ -467,6 +470,9 @@ "DiskImageEncryption", "DiskInstanceView", "EncryptionImages", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", "ExtendedLocation", "Gallery", "GalleryApplication", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py index c0a29e88ce69..db46492e9967 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AdditionalCapabilities(_serialization.Model): @@ -260,7 +255,7 @@ class AutomaticOSUpgradePolicy(_serialization.Model): applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. :code:`
    `\\ :code:`
    ` If this is set to true for Windows based scale sets, `enableAutomaticUpdates - `_ # pylint: disable=line-too-long + `_ is automatically set to false and cannot be set to true. :vartype enable_automatic_os_upgrade: bool :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default @@ -285,7 +280,7 @@ def __init__( applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. :code:`
    `\\ :code:`
    ` If this is set to true for Windows based scale sets, `enableAutomaticUpdates - `_ # pylint: disable=line-too-long + `_ is automatically set to false and cannot be set to true. :paramtype enable_automatic_os_upgrade: bool :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. @@ -403,9 +398,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -516,7 +511,7 @@ def __init__( self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines self.proximity_placement_group = proximity_placement_group - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None class AvailabilitySetListResult(_serialization.Model): @@ -647,7 +642,7 @@ def __init__( self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines self.proximity_placement_group = proximity_placement_group - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None class AvailablePatchSummary(_serialization.Model): @@ -706,14 +701,14 @@ class AvailablePatchSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None - self.assessment_activity_id = None - self.reboot_pending = None - self.critical_and_security_patch_count = None - self.other_patch_count = None - self.start_time = None - self.last_modified_time = None - self.error = None + self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None + self.assessment_activity_id: Optional[str] = None + self.reboot_pending: Optional[bool] = None + self.critical_and_security_patch_count: Optional[int] = None + self.other_patch_count: Optional[int] = None + self.start_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.error: Optional["_models.ApiError"] = None class BillingProfile(_serialization.Model): @@ -825,9 +820,9 @@ class BootDiagnosticsInstanceView(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None - self.status = None + self.console_screenshot_blob_uri: Optional[str] = None + self.serial_console_log_blob_uri: Optional[str] = None + self.status: Optional["_models.InstanceViewStatus"] = None class CapacityReservation(Resource): @@ -932,11 +927,11 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.sku = sku self.zones = zones - self.reservation_id = None - self.virtual_machines_associated = None - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None + self.reservation_id: Optional[str] = None + self.virtual_machines_associated: Optional[List["_models.SubResourceReadOnly"]] = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.CapacityReservationInstanceView"] = None class CapacityReservationGroup(Resource): @@ -1016,9 +1011,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.zones = zones - self.capacity_reservations = None - self.virtual_machines_associated = None - self.instance_view = None + self.capacity_reservations: Optional[List["_models.SubResourceReadOnly"]] = None + self.virtual_machines_associated: Optional[List["_models.SubResourceReadOnly"]] = None + self.instance_view: Optional["_models.CapacityReservationGroupInstanceView"] = None class CapacityReservationGroupInstanceView(_serialization.Model): @@ -1043,7 +1038,7 @@ class CapacityReservationGroupInstanceView(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.capacity_reservations = None + self.capacity_reservations: Optional[List["_models.CapacityReservationInstanceViewWithName"]] = None class CapacityReservationGroupListResult(_serialization.Model): @@ -1122,9 +1117,9 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N :paramtype tags: dict[str, str] """ super().__init__(tags=tags, **kwargs) - self.capacity_reservations = None - self.virtual_machines_associated = None - self.instance_view = None + self.capacity_reservations: Optional[List["_models.SubResourceReadOnly"]] = None + self.virtual_machines_associated: Optional[List["_models.SubResourceReadOnly"]] = None + self.instance_view: Optional["_models.CapacityReservationGroupInstanceView"] = None class CapacityReservationInstanceView(_serialization.Model): @@ -1203,7 +1198,7 @@ def __init__( :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ super().__init__(utilization_info=utilization_info, statuses=statuses, **kwargs) - self.name = None + self.name: Optional[str] = None class CapacityReservationListResult(_serialization.Model): @@ -1330,11 +1325,11 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.sku = sku - self.reservation_id = None - self.virtual_machines_associated = None - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None + self.reservation_id: Optional[str] = None + self.virtual_machines_associated: Optional[List["_models.SubResourceReadOnly"]] = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.CapacityReservationInstanceView"] = None class CapacityReservationUtilization(_serialization.Model): @@ -1359,7 +1354,7 @@ class CapacityReservationUtilization(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.virtual_machines_allocated = None + self.virtual_machines_allocated: Optional[List["_models.SubResourceReadOnly"]] = None class PirCommunityGalleryResource(_serialization.Model): @@ -1396,9 +1391,9 @@ def __init__(self, *, unique_id: Optional[str] = None, **kwargs: Any) -> None: :paramtype unique_id: str """ super().__init__(**kwargs) - self.name = None - self.location = None - self.type = None + self.name: Optional[str] = None + self.location: Optional[str] = None + self.type: Optional[str] = None self.unique_id = unique_id @@ -1619,7 +1614,7 @@ class ComputeOperationListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None + self.value: Optional[List["_models.ComputeOperationValue"]] = None class ComputeOperationValue(_serialization.Model): @@ -1662,12 +1657,12 @@ class ComputeOperationValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.origin = None - self.name = None - self.operation = None - self.resource = None - self.description = None - self.provider = None + self.origin: Optional[str] = None + self.name: Optional[str] = None + self.operation: Optional[str] = None + self.resource: Optional[str] = None + self.description: Optional[str] = None + self.provider: Optional[str] = None class DataDisk(_serialization.Model): @@ -1853,8 +1848,8 @@ def __init__( self.disk_size_gb = disk_size_gb self.managed_disk = managed_disk self.to_be_detached = to_be_detached - self.disk_iops_read_write = None - self.disk_m_bps_read_write = None + self.disk_iops_read_write: Optional[int] = None + self.disk_m_bps_read_write: Optional[int] = None self.detach_option = detach_option self.delete_option = delete_option @@ -1880,7 +1875,7 @@ class DataDiskImage(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.lun = None + self.lun: Optional[int] = None class DiskImageEncryption(_serialization.Model): @@ -2054,12 +2049,12 @@ def __init__( self.sku = sku self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure - self.host_id = None - self.virtual_machines = None + self.host_id: Optional[str] = None + self.virtual_machines: Optional[List["_models.SubResourceReadOnly"]] = None self.license_type = license_type - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.DedicatedHostInstanceView"] = None class DedicatedHostAllocatableVM(_serialization.Model): @@ -2209,8 +2204,8 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count - self.hosts = None - self.instance_view = None + self.hosts: Optional[List["_models.SubResourceReadOnly"]] = None + self.instance_view: Optional["_models.DedicatedHostGroupInstanceView"] = None self.support_automatic_placement = support_automatic_placement @@ -2343,8 +2338,8 @@ def __init__( super().__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count - self.hosts = None - self.instance_view = None + self.hosts: Optional[List["_models.SubResourceReadOnly"]] = None + self.instance_view: Optional["_models.DedicatedHostGroupInstanceView"] = None self.support_automatic_placement = support_automatic_placement @@ -2388,7 +2383,7 @@ def __init__( :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.asset_id = None + self.asset_id: Optional[str] = None self.available_capacity = available_capacity self.statuses = statuses @@ -2438,7 +2433,7 @@ def __init__( :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ super().__init__(available_capacity=available_capacity, statuses=statuses, **kwargs) - self.name = None + self.name: Optional[str] = None class DedicatedHostListResult(_serialization.Model): @@ -2557,12 +2552,12 @@ def __init__( super().__init__(tags=tags, **kwargs) self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure - self.host_id = None - self.virtual_machines = None + self.host_id: Optional[str] = None + self.virtual_machines: Optional[List["_models.SubResourceReadOnly"]] = None self.license_type = license_type - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.DedicatedHostInstanceView"] = None class DiagnosticsProfile(_serialization.Model): @@ -2835,6 +2830,98 @@ def __init__( self.data_disk_images = data_disk_images +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: Optional[str] = None + self.info: Optional[JSON] = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.compute.v2021_07_01.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.compute.v2021_07_01.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.compute.v2021_07_01.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.compute.v2021_07_01.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + class ExtendedLocation(_serialization.Model): """The complex type of the extended location. @@ -2950,7 +3037,7 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.description = description self.identifier = identifier - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryPropertiesProvisioningState"]] = None self.sharing_profile = sharing_profile self.soft_delete_policy = soft_delete_policy @@ -3130,9 +3217,9 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -3300,8 +3387,10 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None - self.replication_status = None + self.provisioning_state: Optional[ + Union[str, "_models.GalleryApplicationVersionPropertiesProvisioningState"] + ] = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryApplicationVersionList(_serialization.Model): @@ -3421,7 +3510,7 @@ def __init__( self.target_regions = target_regions self.replica_count = replica_count self.exclude_from_latest = exclude_from_latest - self.published_date = None + self.published_date: Optional[datetime.datetime] = None self.end_of_life_date = end_of_life_date self.storage_account_type = storage_account_type self.replication_mode = replication_mode @@ -3601,8 +3690,10 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None - self.replication_status = None + self.provisioning_state: Optional[ + Union[str, "_models.GalleryApplicationVersionPropertiesProvisioningState"] + ] = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryArtifactSource(_serialization.Model): @@ -3702,7 +3793,7 @@ def __init__( :paramtype source: ~azure.mgmt.compute.v2021_07_01.models.GalleryArtifactVersionSource """ super().__init__(**kwargs) - self.size_in_gb = None + self.size_in_gb: Optional[int] = None self.host_caching = host_caching self.source = source @@ -3783,7 +3874,7 @@ class GalleryIdentifier(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.unique_name = None + self.unique_name: Optional[str] = None class GalleryImage(Resource): @@ -3950,7 +4041,7 @@ def __init__( self.recommended = recommended self.disallowed = disallowed self.purchase_plan = purchase_plan - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImagePropertiesProvisioningState"]] = None self.features = features @@ -4209,7 +4300,7 @@ def __init__( self.recommended = recommended self.disallowed = disallowed self.purchase_plan = purchase_plan - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImagePropertiesProvisioningState"]] = None self.features = features @@ -4288,9 +4379,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImageVersionPropertiesProvisioningState"]] = None self.storage_profile = storage_profile - self.replication_status = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryImageVersionList(_serialization.Model): @@ -4464,9 +4555,9 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImageVersionPropertiesProvisioningState"]] = None self.storage_profile = storage_profile - self.replication_status = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryList(_serialization.Model): @@ -4592,7 +4683,7 @@ def __init__( super().__init__(tags=tags, **kwargs) self.description = description self.identifier = identifier - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryPropertiesProvisioningState"]] = None self.sharing_profile = sharing_profile self.soft_delete_policy = soft_delete_policy @@ -4818,7 +4909,7 @@ def __init__( self.extended_location = extended_location self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.hyper_v_generation = hyper_v_generation @@ -5299,7 +5390,7 @@ def __init__( self.offer = offer self.sku = sku self.version = version - self.exact_version = None + self.exact_version: Optional[str] = None self.shared_gallery_image_id = shared_gallery_image_id @@ -5417,7 +5508,7 @@ def __init__( super().__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.hyper_v_generation = hyper_v_generation @@ -5637,17 +5728,17 @@ class LastPatchInstallationSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None - self.installation_activity_id = None - self.maintenance_window_exceeded = None - self.not_selected_patch_count = None - self.excluded_patch_count = None - self.pending_patch_count = None - self.installed_patch_count = None - self.failed_patch_count = None - self.start_time = None - self.last_modified_time = None - self.error = None + self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None + self.installation_activity_id: Optional[str] = None + self.maintenance_window_exceeded: Optional[bool] = None + self.not_selected_patch_count: Optional[int] = None + self.excluded_patch_count: Optional[int] = None + self.pending_patch_count: Optional[int] = None + self.installed_patch_count: Optional[int] = None + self.failed_patch_count: Optional[int] = None + self.start_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.error: Optional["_models.ApiError"] = None class LinuxConfiguration(_serialization.Model): @@ -5958,7 +6049,7 @@ class LogAnalyticsOperationResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.properties = None + self.properties: Optional["_models.LogAnalyticsOutput"] = None class LogAnalyticsOutput(_serialization.Model): @@ -5981,7 +6072,7 @@ class LogAnalyticsOutput(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.output = None + self.output: Optional[str] = None class MaintenanceRedeployStatus(_serialization.Model): @@ -6294,8 +6385,8 @@ class OrchestrationServiceSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.service_name = None - self.service_state = None + self.service_name: Optional[Union[str, "_models.OrchestrationServiceNames"]] = None + self.service_state: Optional[Union[str, "_models.OrchestrationServiceState"]] = None class OSDisk(_serialization.Model): @@ -6719,12 +6810,12 @@ class PatchInstallationDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.patch_id = None - self.name = None - self.version = None - self.kb_id = None - self.classifications = None - self.installation_state = None + self.patch_id: Optional[str] = None + self.name: Optional[str] = None + self.version: Optional[str] = None + self.kb_id: Optional[str] = None + self.classifications: Optional[List[str]] = None + self.installation_state: Optional[Union[str, "_models.PatchInstallationState"]] = None class PatchSettings(_serialization.Model): @@ -6826,8 +6917,8 @@ class PirResource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.location = None + self.name: Optional[str] = None + self.location: Optional[str] = None class PirSharedGalleryResource(PirResource): @@ -7005,9 +7096,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.proximity_placement_group_type = proximity_placement_group_type - self.virtual_machines = None - self.virtual_machine_scale_sets = None - self.availability_sets = None + self.virtual_machines: Optional[List["_models.SubResourceWithColocationStatus"]] = None + self.virtual_machine_scale_sets: Optional[List["_models.SubResourceWithColocationStatus"]] = None + self.availability_sets: Optional[List["_models.SubResourceWithColocationStatus"]] = None self.colocation_status = colocation_status @@ -7082,9 +7173,9 @@ class ProxyResource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None class PublicIPAddressSku(_serialization.Model): @@ -7220,8 +7311,8 @@ class RecoveryWalkResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.walk_performed = None - self.next_platform_update_domain = None + self.walk_performed: Optional[bool] = None + self.next_platform_update_domain: Optional[int] = None class RegionalReplicationStatus(_serialization.Model): @@ -7257,10 +7348,10 @@ class RegionalReplicationStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.region = None - self.state = None - self.details = None - self.progress = None + self.region: Optional[str] = None + self.state: Optional[Union[str, "_models.ReplicationState"]] = None + self.details: Optional[str] = None + self.progress: Optional[int] = None class ReplicationStatus(_serialization.Model): @@ -7289,8 +7380,8 @@ class ReplicationStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.aggregated_state = None - self.summary = None + self.aggregated_state: Optional[Union[str, "_models.AggregatedReplicationState"]] = None + self.summary: Optional[List["_models.RegionalReplicationStatus"]] = None class RequestRateByIntervalInput(LogAnalyticsInputBase): @@ -7493,19 +7584,19 @@ class ResourceSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.resource_type = None - self.name = None - self.tier = None - self.size = None - self.family = None - self.kind = None - self.capacity = None - self.locations = None - self.location_info = None - self.api_versions = None - self.costs = None - self.capabilities = None - self.restrictions = None + self.resource_type: Optional[str] = None + self.name: Optional[str] = None + self.tier: Optional[str] = None + self.size: Optional[str] = None + self.family: Optional[str] = None + self.kind: Optional[str] = None + self.capacity: Optional["_models.ResourceSkuCapacity"] = None + self.locations: Optional[List[str]] = None + self.location_info: Optional[List["_models.ResourceSkuLocationInfo"]] = None + self.api_versions: Optional[List[str]] = None + self.costs: Optional[List["_models.ResourceSkuCosts"]] = None + self.capabilities: Optional[List["_models.ResourceSkuCapabilities"]] = None + self.restrictions: Optional[List["_models.ResourceSkuRestrictions"]] = None class ResourceSkuCapabilities(_serialization.Model): @@ -7532,8 +7623,8 @@ class ResourceSkuCapabilities(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.value = None + self.name: Optional[str] = None + self.value: Optional[str] = None class ResourceSkuCapacity(_serialization.Model): @@ -7569,10 +7660,10 @@ class ResourceSkuCapacity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default = None - self.scale_type = None + self.minimum: Optional[int] = None + self.maximum: Optional[int] = None + self.default: Optional[int] = None + self.scale_type: Optional[Union[str, "_models.ResourceSkuCapacityScaleType"]] = None class ResourceSkuCosts(_serialization.Model): @@ -7603,9 +7694,9 @@ class ResourceSkuCosts(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.meter_id = None - self.quantity = None - self.extended_unit = None + self.meter_id: Optional[str] = None + self.quantity: Optional[int] = None + self.extended_unit: Optional[str] = None class ResourceSkuLocationInfo(_serialization.Model): @@ -7644,11 +7735,11 @@ class ResourceSkuLocationInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.location = None - self.zones = None - self.zone_details = None - self.extended_locations = None - self.type = None + self.location: Optional[str] = None + self.zones: Optional[List[str]] = None + self.zone_details: Optional[List["_models.ResourceSkuZoneDetails"]] = None + self.extended_locations: Optional[List[str]] = None + self.type: Optional[Union[str, "_models.ExtendedLocationType"]] = None class ResourceSkuRestrictionInfo(_serialization.Model): @@ -7675,8 +7766,8 @@ class ResourceSkuRestrictionInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.locations = None - self.zones = None + self.locations: Optional[List[str]] = None + self.zones: Optional[List[str]] = None class ResourceSkuRestrictions(_serialization.Model): @@ -7714,10 +7805,10 @@ class ResourceSkuRestrictions(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.values = None - self.restriction_info = None - self.reason_code = None + self.type: Optional[Union[str, "_models.ResourceSkuRestrictionsType"]] = None + self.values: Optional[List[str]] = None + self.restriction_info: Optional["_models.ResourceSkuRestrictionInfo"] = None + self.reason_code: Optional[Union[str, "_models.ResourceSkuRestrictionsReasonCode"]] = None class ResourceSkusResult(_serialization.Model): @@ -7725,10 +7816,9 @@ class ResourceSkusResult(_serialization.Model): All required parameters must be populated in order to send to server. - :ivar value: The list of skus available for the subscription. Required. + :ivar value: The ResourceSku items on this page. Required. :vartype value: list[~azure.mgmt.compute.v2021_07_01.models.ResourceSku] - :ivar next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this URI - to fetch the next page of Resource Skus. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -7743,10 +7833,9 @@ class ResourceSkusResult(_serialization.Model): def __init__(self, *, value: List["_models.ResourceSku"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: The list of skus available for the subscription. Required. + :keyword value: The ResourceSku items on this page. Required. :paramtype value: list[~azure.mgmt.compute.v2021_07_01.models.ResourceSku] - :keyword next_link: The URI to fetch the next page of Resource Skus. Call ListNext() with this - URI to fetch the next page of Resource Skus. + :keyword next_link: The link to the next page of items. :paramtype next_link: str """ super().__init__(**kwargs) @@ -7779,8 +7868,8 @@ class ResourceSkuZoneDetails(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.capabilities = None + self.name: Optional[List[str]] = None + self.capabilities: Optional[List["_models.ResourceSkuCapabilities"]] = None class RestorePoint(ProxyResource): @@ -7846,9 +7935,9 @@ def __init__( """ super().__init__(**kwargs) self.exclude_disks = exclude_disks - self.source_metadata = None - self.provisioning_state = None - self.consistency_mode = None + self.source_metadata: Optional["_models.RestorePointSourceMetadata"] = None + self.provisioning_state: Optional[str] = None + self.consistency_mode: Optional[Union[str, "_models.ConsistencyModeTypes"]] = None self.time_created = time_created @@ -7923,9 +8012,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.source = source - self.provisioning_state = None - self.restore_point_collection_id = None - self.restore_points = None + self.provisioning_state: Optional[str] = None + self.restore_point_collection_id: Optional[str] = None + self.restore_points: Optional[List["_models.RestorePoint"]] = None class RestorePointCollectionListResult(_serialization.Model): @@ -7988,7 +8077,7 @@ def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylin :paramtype id: str """ super().__init__(**kwargs) - self.location = None + self.location: Optional[str] = None self.id = id @@ -8042,9 +8131,9 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.source = source - self.provisioning_state = None - self.restore_point_collection_id = None - self.restore_points = None + self.provisioning_state: Optional[str] = None + self.restore_point_collection_id: Optional[str] = None + self.restore_points: Optional[List["_models.RestorePoint"]] = None class RestorePointSourceMetadata(_serialization.Model): @@ -8314,8 +8403,8 @@ class RetrieveBootDiagnosticsDataResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None + self.console_screenshot_blob_uri: Optional[str] = None + self.serial_console_log_blob_uri: Optional[str] = None class RollbackStatusInfo(_serialization.Model): @@ -8347,9 +8436,9 @@ class RollbackStatusInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successfully_rolledback_instance_count = None - self.failed_rolledback_instance_count = None - self.rollback_error = None + self.successfully_rolledback_instance_count: Optional[int] = None + self.failed_rolledback_instance_count: Optional[int] = None + self.rollback_error: Optional["_models.ApiError"] = None class RollingUpgradePolicy(_serialization.Model): @@ -8481,10 +8570,10 @@ class RollingUpgradeProgressInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successful_instance_count = None - self.failed_instance_count = None - self.in_progress_instance_count = None - self.pending_instance_count = None + self.successful_instance_count: Optional[int] = None + self.failed_instance_count: Optional[int] = None + self.in_progress_instance_count: Optional[int] = None + self.pending_instance_count: Optional[int] = None class RollingUpgradeRunningStatus(_serialization.Model): @@ -8521,10 +8610,10 @@ class RollingUpgradeRunningStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.last_action = None - self.last_action_time = None + self.code: Optional[Union[str, "_models.RollingUpgradeStatusCode"]] = None + self.start_time: Optional[datetime.datetime] = None + self.last_action: Optional[Union[str, "_models.RollingUpgradeActionType"]] = None + self.last_action_time: Optional[datetime.datetime] = None class RollingUpgradeStatusInfo(Resource): @@ -8586,10 +8675,10 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(location=location, tags=tags, **kwargs) - self.policy = None - self.running_status = None - self.progress = None - self.error = None + self.policy: Optional["_models.RollingUpgradePolicy"] = None + self.running_status: Optional["_models.RollingUpgradeRunningStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None class RunCommandDocumentBase(_serialization.Model): @@ -9386,7 +9475,7 @@ def __init__( """ super().__init__(**kwargs) self.permissions = permissions - self.groups = None + self.groups: Optional[List["_models.SharingProfileGroup"]] = None class SharingProfileGroup(_serialization.Model): @@ -9636,7 +9725,7 @@ class SshPublicKeyGenerateKeyPairResult(_serialization.Model): through ssh. The public key is in ssh-rsa format. Required. :vartype public_key: str :ivar id: The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. Required. :vartype id: str """ @@ -9665,7 +9754,7 @@ def __init__( machine through ssh. The public key is in ssh-rsa format. Required. :paramtype public_key: str :keyword id: The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. Required. :paramtype id: str """ @@ -9879,7 +9968,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class SubResourceWithColocationStatus(SubResource): @@ -10097,9 +10186,9 @@ class UpgradeOperationHistoricalStatusInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.properties = None - self.type = None - self.location = None + self.properties: Optional["_models.UpgradeOperationHistoricalStatusInfoProperties"] = None + self.type: Optional[str] = None + self.location: Optional[str] = None class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # pylint: disable=name-too-long @@ -10143,12 +10232,12 @@ class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # p def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.running_status = None - self.progress = None - self.error = None - self.started_by = None - self.target_image_reference = None - self.rollback_info = None + self.running_status: Optional["_models.UpgradeOperationHistoryStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None + self.started_by: Optional[Union[str, "_models.UpgradeOperationInvoker"]] = None + self.target_image_reference: Optional["_models.ImageReference"] = None + self.rollback_info: Optional["_models.RollbackStatusInfo"] = None class UpgradeOperationHistoryStatus(_serialization.Model): @@ -10180,9 +10269,9 @@ class UpgradeOperationHistoryStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.end_time = None + self.code: Optional[Union[str, "_models.UpgradeState"]] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None class UpgradePolicy(_serialization.Model): @@ -10422,8 +10511,8 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class VaultCertificate(_serialization.Model): @@ -10894,7 +10983,7 @@ def __init__( # pylint: disable=too-many-locals """ super().__init__(location=location, tags=tags, **kwargs) self.plan = plan - self.resources = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None self.identity = identity self.zones = zones self.extended_location = extended_location @@ -10913,10 +11002,10 @@ def __init__( # pylint: disable=too-many-locals self.billing_profile = billing_profile self.host = host self.host_group = host_group - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None self.extensions_time_budget = extensions_time_budget self.platform_fault_domain = platform_fault_domain self.scheduled_events_profile = scheduled_events_profile @@ -11024,14 +11113,14 @@ class VirtualMachineAssessPatchesResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None - self.assessment_activity_id = None - self.reboot_pending = None - self.critical_and_security_patch_count = None - self.other_patch_count = None - self.start_date_time = None - self.available_patches = None - self.error = None + self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None + self.assessment_activity_id: Optional[str] = None + self.reboot_pending: Optional[bool] = None + self.critical_and_security_patch_count: Optional[int] = None + self.other_patch_count: Optional[int] = None + self.start_date_time: Optional[datetime.datetime] = None + self.available_patches: Optional[List["_models.VirtualMachineSoftwarePatchProperties"]] = None + self.error: Optional["_models.ApiError"] = None class VirtualMachineCaptureParameters(_serialization.Model): @@ -11116,10 +11205,10 @@ def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylin :paramtype id: str """ super().__init__(id=id, **kwargs) - self.schema = None - self.content_version = None - self.parameters = None - self.resources = None + self.schema: Optional[str] = None + self.content_version: Optional[str] = None + self.parameters: Optional[JSON] = None + self.resources: Optional[List[JSON]] = None class VirtualMachineExtension(Resource): @@ -11260,7 +11349,7 @@ def __init__( self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.instance_view = instance_view self.suppress_failures = suppress_failures @@ -11589,7 +11678,7 @@ class VirtualMachineHealthStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None + self.status: Optional["_models.InstanceViewStatus"] = None class VirtualMachineIdentity(_serialization.Model): @@ -11610,7 +11699,7 @@ class VirtualMachineIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.compute.v2021_07_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2021_07_01.models.UserAssignedIdentitiesValue] """ @@ -11642,13 +11731,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.compute.v2021_07_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2021_07_01.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -12001,18 +12090,18 @@ class VirtualMachineInstallPatchesResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None - self.installation_activity_id = None - self.reboot_status = None - self.maintenance_window_exceeded = None - self.excluded_patch_count = None - self.not_selected_patch_count = None - self.pending_patch_count = None - self.installed_patch_count = None - self.failed_patch_count = None - self.patches = None - self.start_date_time = None - self.error = None + self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None + self.installation_activity_id: Optional[str] = None + self.reboot_status: Optional[Union[str, "_models.VMGuestPatchRebootStatus"]] = None + self.maintenance_window_exceeded: Optional[bool] = None + self.excluded_patch_count: Optional[int] = None + self.not_selected_patch_count: Optional[int] = None + self.pending_patch_count: Optional[int] = None + self.installed_patch_count: Optional[int] = None + self.failed_patch_count: Optional[int] = None + self.patches: Optional[List["_models.PatchInstallationDetail"]] = None + self.start_date_time: Optional[datetime.datetime] = None + self.error: Optional["_models.ApiError"] = None class VirtualMachineInstanceView(_serialization.Model): @@ -12155,9 +12244,9 @@ def __init__( self.maintenance_redeploy_status = maintenance_redeploy_status self.disks = disks self.extensions = extensions - self.vm_health = None + self.vm_health: Optional["_models.VirtualMachineHealthStatus"] = None self.boot_diagnostics = boot_diagnostics - self.assigned_host = None + self.assigned_host: Optional[str] = None self.statuses = statuses self.patch_status = patch_status @@ -12520,7 +12609,7 @@ def __init__( super().__init__(**kwargs) self.available_patch_summary = available_patch_summary self.last_patch_installation_summary = last_patch_installation_summary - self.configuration_statuses = None + self.configuration_statuses: Optional[List["_models.InstanceViewStatus"]] = None class VirtualMachinePublicIPAddressConfiguration(_serialization.Model): # pylint: disable=name-too-long @@ -12808,8 +12897,8 @@ def __init__( self.timeout_in_seconds = timeout_in_seconds self.output_blob_uri = output_blob_uri self.error_blob_uri = error_blob_uri - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineRunCommandInstanceView"] = None class VirtualMachineRunCommandInstanceView(_serialization.Model): @@ -13070,8 +13159,8 @@ def __init__( self.timeout_in_seconds = timeout_in_seconds self.output_blob_uri = output_blob_uri self.error_blob_uri = error_blob_uri - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineRunCommandInstanceView"] = None class VirtualMachineScaleSet(Resource): @@ -13306,10 +13395,10 @@ def __init__( # pylint: disable=too-many-locals self.upgrade_policy = upgrade_policy self.automatic_repairs_policy = automatic_repairs_policy self.virtual_machine_profile = virtual_machine_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.overprovision = overprovision self.do_not_run_extensions_on_overprovisioned_v_ms = do_not_run_extensions_on_overprovisioned_v_ms - self.unique_id = None + self.unique_id: Optional[str] = None self.single_placement_group = single_placement_group self.zone_balance = zone_balance self.platform_fault_domain_count = platform_fault_domain_count @@ -13557,7 +13646,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.type = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -13566,7 +13655,7 @@ def __init__( self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.provision_after_extensions = provision_after_extensions self.suppress_failures = suppress_failures @@ -13762,8 +13851,8 @@ def __init__( :paramtype suppress_failures: bool """ super().__init__(**kwargs) - self.name = None - self.type = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -13772,7 +13861,7 @@ def __init__( self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.provision_after_extensions = provision_after_extensions self.suppress_failures = suppress_failures @@ -13796,7 +13885,7 @@ class VirtualMachineScaleSetIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.compute.v2021_07_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ @@ -13835,13 +13924,13 @@ def __init__( :keyword user_assigned_identities: The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2021_07_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -13870,8 +13959,8 @@ class VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue(_serialization.M def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class VirtualMachineScaleSetInstanceView(_serialization.Model): @@ -13911,10 +14000,10 @@ def __init__(self, *, statuses: Optional[List["_models.InstanceViewStatus"]] = N :paramtype statuses: list[~azure.mgmt.compute.v2021_07_01.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.virtual_machine = None - self.extensions = None + self.virtual_machine: Optional["_models.VirtualMachineScaleSetInstanceViewStatusesSummary"] = None + self.extensions: Optional[List["_models.VirtualMachineScaleSetVMExtensionsSummary"]] = None self.statuses = statuses - self.orchestration_services = None + self.orchestration_services: Optional[List["_models.OrchestrationServiceSummary"]] = None class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): # pylint: disable=name-too-long @@ -13938,7 +14027,7 @@ class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.statuses_summary = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetIPConfiguration(SubResource): @@ -14424,7 +14513,7 @@ class VirtualMachineScaleSetNetworkProfile(_serialization.Model): :ivar health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :vartype health_probe: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference :ivar network_interface_configurations: The list of network configurations. :vartype network_interface_configurations: @@ -14455,7 +14544,7 @@ def __init__( """ :keyword health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :paramtype health_probe: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference :keyword network_interface_configurations: The list of network configurations. :paramtype network_interface_configurations: @@ -14929,9 +15018,9 @@ class VirtualMachineScaleSetSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.resource_type = None - self.sku = None - self.capacity = None + self.resource_type: Optional[str] = None + self.sku: Optional["_models.Sku"] = None + self.capacity: Optional["_models.VirtualMachineScaleSetSkuCapacity"] = None class VirtualMachineScaleSetSkuCapacity(_serialization.Model): @@ -14968,10 +15057,10 @@ class VirtualMachineScaleSetSkuCapacity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default_capacity = None - self.scale_type = None + self.minimum: Optional[int] = None + self.maximum: Optional[int] = None + self.default_capacity: Optional[int] = None + self.scale_type: Optional[Union[str, "_models.VirtualMachineScaleSetSkuScaleType"]] = None class VirtualMachineScaleSetStorageProfile(_serialization.Model): @@ -15399,7 +15488,7 @@ class VirtualMachineScaleSetUpdateNetworkProfile(_serialization.Model): # pylin :ivar health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :vartype health_probe: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference :ivar network_interface_configurations: The list of network configurations. :vartype network_interface_configurations: @@ -15432,7 +15521,7 @@ def __init__( """ :keyword health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :paramtype health_probe: ~azure.mgmt.compute.v2021_07_01.models.ApiEntityReference :keyword network_interface_configurations: The list of network configurations. :paramtype network_interface_configurations: @@ -15994,14 +16083,14 @@ def __init__( # pylint: disable=too-many-locals :paramtype user_data: str """ super().__init__(location=location, tags=tags, **kwargs) - self.instance_id = None - self.sku = None + self.instance_id: Optional[str] = None + self.sku: Optional["_models.Sku"] = None self.plan = plan - self.resources = None - self.zones = None - self.latest_model_applied = None - self.vm_id = None - self.instance_view = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None + self.zones: Optional[List[str]] = None + self.latest_model_applied: Optional[bool] = None + self.vm_id: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineScaleSetVMInstanceView"] = None self.hardware_profile = hardware_profile self.storage_profile = storage_profile self.additional_capabilities = additional_capabilities @@ -16011,9 +16100,9 @@ def __init__( # pylint: disable=too-many-locals self.network_profile_configuration = network_profile_configuration self.diagnostics_profile = diagnostics_profile self.availability_set = availability_set - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.license_type = license_type - self.model_definition_applied = None + self.model_definition_applied: Optional[str] = None self.protection_policy = protection_policy self.user_data = user_data @@ -16133,8 +16222,8 @@ def __init__( :paramtype suppress_failures: bool """ super().__init__(**kwargs) - self.name = None - self.type = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -16143,7 +16232,7 @@ def __init__( self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.instance_view = instance_view self.suppress_failures = suppress_failures @@ -16196,8 +16285,8 @@ class VirtualMachineScaleSetVMExtensionsSummary(_serialization.Model): # pylint def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.statuses_summary = None + self.name: Optional[str] = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): @@ -16303,8 +16392,8 @@ def __init__( :paramtype suppress_failures: bool """ super().__init__(**kwargs) - self.name = None - self.type = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -16477,10 +16566,10 @@ def __init__( self.maintenance_redeploy_status = maintenance_redeploy_status self.disks = disks self.extensions = extensions - self.vm_health = None + self.vm_health: Optional["_models.VirtualMachineHealthStatus"] = None self.boot_diagnostics = boot_diagnostics self.statuses = statuses - self.assigned_host = None + self.assigned_host: Optional[str] = None self.placement_group_id = placement_group_id @@ -16922,16 +17011,16 @@ class VirtualMachineSoftwarePatchProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.patch_id = None - self.name = None - self.version = None - self.kb_id = None - self.classifications = None - self.reboot_behavior = None - self.activity_id = None - self.published_date = None - self.last_modified_date_time = None - self.assessment_state = None + self.patch_id: Optional[str] = None + self.name: Optional[str] = None + self.version: Optional[str] = None + self.kb_id: Optional[str] = None + self.classifications: Optional[List[str]] = None + self.reboot_behavior: Optional[Union[str, "_models.VMGuestPatchRebootBehavior"]] = None + self.activity_id: Optional[str] = None + self.published_date: Optional[datetime.datetime] = None + self.last_modified_date_time: Optional[datetime.datetime] = None + self.assessment_state: Optional[Union[str, "_models.PatchAssessmentState"]] = None class VirtualMachineStatusCodeCount(_serialization.Model): @@ -16958,8 +17047,8 @@ class VirtualMachineStatusCodeCount(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.count = None + self.code: Optional[str] = None + self.count: Optional[int] = None class VirtualMachineUpdate(UpdateResource): @@ -17299,10 +17388,10 @@ def __init__( # pylint: disable=too-many-locals self.billing_profile = billing_profile self.host = host self.host_group = host_group - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None self.extensions_time_budget = extensions_time_budget self.platform_fault_domain = platform_fault_domain self.scheduled_events_profile = scheduled_events_profile @@ -17321,7 +17410,7 @@ class VMGalleryApplication(_serialization.Model): :ivar order: Optional, Specifies the order in which the packages have to be installed. :vartype order: int :ivar package_reference_id: Specifies the GalleryApplicationVersion resource id on the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. Required. :vartype package_reference_id: str :ivar configuration_reference: Optional, Specifies the uri to an azure blob that will replace @@ -17356,7 +17445,7 @@ def __init__( :paramtype order: int :keyword package_reference_id: Specifies the GalleryApplicationVersion resource id on the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. Required. :paramtype package_reference_id: str :keyword configuration_reference: Optional, Specifies the uri to an azure blob that will diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py index 8f5241fe1265..c1d6807ac185 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +75,7 @@ def build_availability_sets_create_or_update_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -111,7 +109,7 @@ def build_availability_sets_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -141,7 +139,7 @@ def build_availability_sets_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -169,7 +167,7 @@ def build_availability_sets_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -226,7 +224,7 @@ def build_availability_sets_list_request(resource_group_name: str, subscription_ _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -256,7 +254,7 @@ def build_availability_sets_list_available_sizes_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), @@ -288,7 +286,7 @@ def build_proximity_placement_groups_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -324,7 +322,7 @@ def build_proximity_placement_groups_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -356,7 +354,7 @@ def build_proximity_placement_groups_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -391,7 +389,7 @@ def build_proximity_placement_groups_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "proximityPlacementGroupName": _SERIALIZER.url( @@ -456,7 +454,7 @@ def build_proximity_placement_groups_list_by_resource_group_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -487,7 +485,7 @@ def build_dedicated_host_groups_create_or_update_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -521,7 +519,7 @@ def build_dedicated_host_groups_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -551,7 +549,7 @@ def build_dedicated_host_groups_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -584,7 +582,7 @@ def build_dedicated_host_groups_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -617,7 +615,7 @@ def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -674,7 +672,7 @@ def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -709,7 +707,7 @@ def build_dedicated_hosts_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -740,7 +738,7 @@ def build_dedicated_hosts_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -775,7 +773,7 @@ def build_dedicated_hosts_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -809,7 +807,7 @@ def build_dedicated_hosts_list_by_host_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), @@ -866,7 +864,7 @@ def build_ssh_public_keys_list_by_resource_group_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -897,7 +895,7 @@ def build_ssh_public_keys_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -931,7 +929,7 @@ def build_ssh_public_keys_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -961,7 +959,7 @@ def build_ssh_public_keys_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -989,7 +987,7 @@ def build_ssh_public_keys_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -1020,7 +1018,7 @@ def build_ssh_public_keys_generate_key_pair_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), @@ -1051,7 +1049,7 @@ def build_virtual_machine_extension_images_get_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1084,7 +1082,7 @@ def build_virtual_machine_extension_images_list_types_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1123,7 +1121,7 @@ def build_virtual_machine_extension_images_list_versions_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1162,7 +1160,7 @@ def build_virtual_machine_extensions_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1197,7 +1195,7 @@ def build_virtual_machine_extensions_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1228,7 +1226,7 @@ def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1263,7 +1261,7 @@ def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1297,7 +1295,7 @@ def build_virtual_machine_extensions_list_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1330,7 +1328,7 @@ def build_virtual_machine_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1373,7 +1371,7 @@ def build_virtual_machine_images_list_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1412,7 +1410,7 @@ def build_virtual_machine_images_list_offers_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1442,7 +1440,7 @@ def build_virtual_machine_images_list_publishers_request( # pylint: disable=nam # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1472,7 +1470,7 @@ def build_virtual_machine_images_list_skus_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), @@ -1511,7 +1509,7 @@ def build_virtual_machine_images_edge_zone_get_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), @@ -1556,7 +1554,7 @@ def build_virtual_machine_images_edge_zone_list_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), @@ -1596,7 +1594,7 @@ def build_virtual_machine_images_edge_zone_list_offers_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), @@ -1628,7 +1626,7 @@ def build_virtual_machine_images_edge_zone_list_publishers_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), @@ -1659,7 +1657,7 @@ def build_virtual_machine_images_edge_zone_list_skus_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), @@ -1689,7 +1687,7 @@ def build_usage_list_request(location: str, subscription_id: str, **kwargs: Any) # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1719,7 +1717,7 @@ def build_virtual_machines_list_by_location_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1750,7 +1748,7 @@ def build_virtual_machines_capture_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1784,7 +1782,7 @@ def build_virtual_machines_create_or_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1818,7 +1816,7 @@ def build_virtual_machines_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1853,7 +1851,7 @@ def build_virtual_machines_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1888,7 +1886,7 @@ def build_virtual_machines_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1921,7 +1919,7 @@ def build_virtual_machines_instance_view_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1949,7 +1947,7 @@ def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -1974,7 +1972,7 @@ def build_virtual_machines_deallocate_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2001,7 +1999,7 @@ def build_virtual_machines_generalize_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2027,7 +2025,7 @@ def build_virtual_machines_list_request(resource_group_name: str, subscription_i _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2085,7 +2083,7 @@ def build_virtual_machines_list_available_sizes_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2113,7 +2111,7 @@ def build_virtual_machines_power_off_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2143,7 +2141,7 @@ def build_virtual_machines_reapply_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2171,7 +2169,7 @@ def build_virtual_machines_restart_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2196,7 +2194,7 @@ def build_virtual_machines_start_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2221,7 +2219,7 @@ def build_virtual_machines_redeploy_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2248,7 +2246,7 @@ def build_virtual_machines_reimage_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2285,7 +2283,7 @@ def build_virtual_machines_retrieve_boot_diagnostics_data_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2317,7 +2315,7 @@ def build_virtual_machines_perform_maintenance_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2342,7 +2340,7 @@ def build_virtual_machines_simulate_eviction_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2370,7 +2368,7 @@ def build_virtual_machines_assess_patches_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2402,7 +2400,7 @@ def build_virtual_machines_install_patches_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2436,7 +2434,7 @@ def build_virtual_machines_run_command_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -2469,7 +2467,7 @@ def build_virtual_machine_scale_sets_list_by_location_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2500,7 +2498,7 @@ def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2534,7 +2532,7 @@ def build_virtual_machine_scale_sets_update_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2569,7 +2567,7 @@ def build_virtual_machine_scale_sets_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2604,7 +2602,7 @@ def build_virtual_machine_scale_sets_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2636,7 +2634,7 @@ def build_virtual_machine_scale_sets_deallocate_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2672,7 +2670,7 @@ def build_virtual_machine_scale_sets_delete_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2706,7 +2704,7 @@ def build_virtual_machine_scale_sets_get_instance_view_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2737,7 +2735,7 @@ def build_virtual_machine_scale_sets_list_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2795,7 +2793,7 @@ def build_virtual_machine_scale_sets_list_skus_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2826,7 +2824,7 @@ def build_virtual_machine_scale_sets_get_os_upgrade_history_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2861,7 +2859,7 @@ def build_virtual_machine_scale_sets_power_off_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2894,7 +2892,7 @@ def build_virtual_machine_scale_sets_restart_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2925,7 +2923,7 @@ def build_virtual_machine_scale_sets_start_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2956,7 +2954,7 @@ def build_virtual_machine_scale_sets_redeploy_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -2987,7 +2985,7 @@ def build_virtual_machine_scale_sets_perform_maintenance_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3018,7 +3016,7 @@ def build_virtual_machine_scale_sets_update_instances_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3049,7 +3047,7 @@ def build_virtual_machine_scale_sets_reimage_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3080,7 +3078,7 @@ def build_virtual_machine_scale_sets_reimage_all_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3117,7 +3115,7 @@ def build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_upda _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3148,7 +3146,7 @@ def build_virtual_machine_scale_sets_convert_to_single_placement_group_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3179,7 +3177,7 @@ def build_virtual_machine_scale_sets_set_orchestration_service_state_request( # _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -3208,7 +3206,7 @@ def build_virtual_machine_sizes_list_request(location: str, subscription_id: str # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -3239,7 +3237,7 @@ def build_images_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -3273,7 +3271,7 @@ def build_images_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -3303,7 +3301,7 @@ def build_images_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -3331,7 +3329,7 @@ def build_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "imageName": _SERIALIZER.url("image_name", image_name, "str"), @@ -3364,7 +3362,7 @@ def build_images_list_by_resource_group_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -3419,7 +3417,7 @@ def build_restore_point_collections_create_or_update_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3455,7 +3453,7 @@ def build_restore_point_collections_update_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3490,7 +3488,7 @@ def build_restore_point_collections_delete_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3528,7 +3526,7 @@ def build_restore_point_collections_get_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3563,7 +3561,7 @@ def build_restore_point_collections_list_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3626,7 +3624,7 @@ def build_restore_points_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3666,7 +3664,7 @@ def build_restore_points_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3704,7 +3702,7 @@ def build_restore_points_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3739,7 +3737,7 @@ def build_capacity_reservation_groups_create_or_update_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "capacityReservationGroupName": _SERIALIZER.url( @@ -3775,7 +3773,7 @@ def build_capacity_reservation_groups_update_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "capacityReservationGroupName": _SERIALIZER.url( @@ -3810,7 +3808,7 @@ def build_capacity_reservation_groups_delete_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "capacityReservationGroupName": _SERIALIZER.url( @@ -3848,7 +3846,7 @@ def build_capacity_reservation_groups_get_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "capacityReservationGroupName": _SERIALIZER.url( @@ -3887,7 +3885,7 @@ def build_capacity_reservation_groups_list_by_resource_group_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -3921,7 +3919,7 @@ def build_capacity_reservation_groups_list_by_subscription_request( # pylint: d # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -3957,7 +3955,7 @@ def build_capacity_reservations_create_or_update_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "capacityReservationGroupName": _SERIALIZER.url( @@ -3998,7 +3996,7 @@ def build_capacity_reservations_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "capacityReservationGroupName": _SERIALIZER.url( @@ -4038,7 +4036,7 @@ def build_capacity_reservations_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "capacityReservationGroupName": _SERIALIZER.url( @@ -4078,7 +4076,7 @@ def build_capacity_reservations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "capacityReservationGroupName": _SERIALIZER.url( @@ -4114,7 +4112,7 @@ def build_capacity_reservations_list_by_capacity_reservation_group_request( # p _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "capacityReservationGroupName": _SERIALIZER.url( @@ -4148,7 +4146,7 @@ def build_virtual_machine_scale_set_extensions_create_or_update_request( # pyli _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4183,7 +4181,7 @@ def build_virtual_machine_scale_set_extensions_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4214,7 +4212,7 @@ def build_virtual_machine_scale_set_extensions_delete_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4249,7 +4247,7 @@ def build_virtual_machine_scale_set_extensions_get_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4283,7 +4281,7 @@ def build_virtual_machine_scale_set_extensions_list_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4311,7 +4309,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_cancel_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4336,7 +4334,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4361,7 +4359,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_req _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4389,7 +4387,7 @@ def build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( # pyli _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4426,7 +4424,7 @@ def build_virtual_machine_scale_set_vm_extensions_create_or_update_request( # p _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4467,7 +4465,7 @@ def build_virtual_machine_scale_set_vm_extensions_update_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4507,7 +4505,7 @@ def build_virtual_machine_scale_set_vm_extensions_delete_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4547,7 +4545,7 @@ def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4588,7 +4586,7 @@ def build_virtual_machine_scale_set_vm_extensions_list_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4621,7 +4619,7 @@ def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4651,7 +4649,7 @@ def build_virtual_machine_scale_set_vms_reimage_all_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4677,7 +4675,7 @@ def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4707,7 +4705,7 @@ def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4744,7 +4742,7 @@ def build_virtual_machine_scale_set_vms_delete_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4781,7 +4779,7 @@ def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4815,7 +4813,7 @@ def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4854,7 +4852,7 @@ def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "virtualMachineScaleSetName": _SERIALIZER.url( @@ -4896,7 +4894,7 @@ def build_virtual_machine_scale_set_vms_power_off_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4924,7 +4922,7 @@ def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4950,7 +4948,7 @@ def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -4976,7 +4974,7 @@ def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -5011,7 +5009,7 @@ def build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -5044,7 +5042,7 @@ def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -5070,7 +5068,7 @@ def build_virtual_machine_scale_set_vms_simulate_eviction_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -5100,7 +5098,7 @@ def build_virtual_machine_scale_set_vms_run_command_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -5135,7 +5133,7 @@ def build_log_analytics_export_request_rate_by_interval_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -5168,7 +5166,7 @@ def build_log_analytics_export_throttled_requests_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -5199,7 +5197,7 @@ def build_virtual_machine_run_commands_list_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -5229,7 +5227,7 @@ def build_virtual_machine_run_commands_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), "commandId": _SERIALIZER.url("command_id", command_id, "str"), @@ -5261,7 +5259,7 @@ def build_virtual_machine_run_commands_create_or_update_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -5296,7 +5294,7 @@ def build_virtual_machine_run_commands_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -5330,7 +5328,7 @@ def build_virtual_machine_run_commands_delete_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -5368,7 +5366,7 @@ def build_virtual_machine_run_commands_get_by_virtual_machine_request( # pylint _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -5402,7 +5400,7 @@ def build_virtual_machine_run_commands_list_by_virtual_machine_request( # pylin _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), @@ -5441,7 +5439,7 @@ def build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( # _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -5482,7 +5480,7 @@ def build_virtual_machine_scale_set_vm_run_commands_update_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -5522,7 +5520,7 @@ def build_virtual_machine_scale_set_vm_run_commands_delete_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -5562,7 +5560,7 @@ def build_virtual_machine_scale_set_vm_run_commands_get_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -5603,7 +5601,7 @@ def build_virtual_machine_scale_set_vm_run_commands_list_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), @@ -5674,7 +5672,7 @@ def build_galleries_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5708,7 +5706,7 @@ def build_galleries_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5746,7 +5744,7 @@ def build_galleries_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5779,7 +5777,7 @@ def build_galleries_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5810,7 +5808,7 @@ def build_galleries_list_by_resource_group_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5865,7 +5863,7 @@ def build_gallery_images_create_or_update_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5900,7 +5898,7 @@ def build_gallery_images_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5934,7 +5932,7 @@ def build_gallery_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5966,7 +5964,7 @@ def build_gallery_images_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5998,7 +5996,7 @@ def build_gallery_images_list_by_gallery_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6035,7 +6033,7 @@ def build_gallery_image_versions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6076,7 +6074,7 @@ def build_gallery_image_versions_update_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6118,7 +6116,7 @@ def build_gallery_image_versions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6158,7 +6156,7 @@ def build_gallery_image_versions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6191,7 +6189,7 @@ def build_gallery_image_versions_list_by_gallery_image_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6224,7 +6222,7 @@ def build_gallery_applications_create_or_update_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6259,7 +6257,7 @@ def build_gallery_applications_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6293,7 +6291,7 @@ def build_gallery_applications_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6325,7 +6323,7 @@ def build_gallery_applications_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6357,7 +6355,7 @@ def build_gallery_applications_list_by_gallery_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6394,7 +6392,7 @@ def build_gallery_application_versions_create_or_update_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6437,7 +6435,7 @@ def build_gallery_application_versions_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6481,7 +6479,7 @@ def build_gallery_application_versions_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6523,7 +6521,7 @@ def build_gallery_application_versions_delete_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6558,7 +6556,7 @@ def build_gallery_application_versions_list_by_gallery_application_request( # p _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6591,7 +6589,7 @@ def build_gallery_sharing_profile_update_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6628,7 +6626,7 @@ def build_shared_galleries_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -6660,7 +6658,7 @@ def build_shared_galleries_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -6696,7 +6694,7 @@ def build_shared_gallery_images_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -6729,7 +6727,7 @@ def build_shared_gallery_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -6767,7 +6765,7 @@ def build_shared_gallery_image_versions_list_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -6806,7 +6804,7 @@ def build_shared_gallery_image_versions_get_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -6839,7 +6837,7 @@ def build_community_galleries_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -6870,7 +6868,7 @@ def build_community_gallery_images_get_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -6907,7 +6905,7 @@ def build_community_gallery_image_versions_get_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -6941,10 +6939,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7037,10 +7035,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -7658,10 +7656,10 @@ class ProximityPlacementGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -8212,10 +8210,10 @@ class DedicatedHostGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -8765,10 +8763,10 @@ class DedicatedHostsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -9449,10 +9447,10 @@ class SshPublicKeysOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -10048,10 +10046,10 @@ class VirtualMachineExtensionImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -10263,10 +10261,10 @@ class VirtualMachineExtensionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -10941,10 +10939,10 @@ class VirtualMachineImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11274,10 +11272,10 @@ class VirtualMachineImagesEdgeZoneOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11629,10 +11627,10 @@ class UsageOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11728,10 +11726,10 @@ class VirtualMachinesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -14566,10 +14564,10 @@ class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-meth def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -17937,10 +17935,10 @@ class VirtualMachineSizesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -18036,10 +18034,10 @@ class ImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -18732,10 +18730,10 @@ class RestorePointCollectionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -19347,10 +19345,10 @@ class RestorePointsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_initial( @@ -19739,10 +19737,10 @@ class CapacityReservationGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -20329,10 +20327,10 @@ class CapacityReservationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -21037,10 +21035,10 @@ class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -21742,10 +21740,10 @@ class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-t def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -22131,10 +22129,10 @@ class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too- def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -22847,10 +22845,10 @@ class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-me def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _reimage_initial( @@ -24751,10 +24749,10 @@ class LogAnalyticsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _export_request_rate_by_interval_initial( @@ -25123,10 +25121,10 @@ class VirtualMachineRunCommandsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -25960,10 +25958,10 @@ class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -26698,10 +26696,10 @@ class ResourceSkusOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -26782,7 +26780,8 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -26803,10 +26802,10 @@ class GalleriesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -27518,10 +27517,10 @@ class GalleryImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -28213,10 +28212,10 @@ class GalleryImageVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -28991,10 +28990,10 @@ class GalleryApplicationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -29698,10 +29697,10 @@ class GalleryApplicationVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -30481,10 +30480,10 @@ class GallerySharingProfileOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _update_initial( @@ -30691,10 +30690,10 @@ class SharedGalleriesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -30849,10 +30848,10 @@ class SharedGalleryImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -31021,10 +31020,10 @@ class SharedGalleryImageVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -31211,10 +31210,10 @@ class CommunityGalleriesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -31286,10 +31285,10 @@ class CommunityGalleryImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -31366,10 +31365,10 @@ class CommunityGalleryImageVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_compute_management_client.py index c0db86ff27ea..d033007feacd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -55,7 +57,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-10-01". Note that overriding this default value may result in unsupported behavior. @@ -65,15 +67,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -92,7 +96,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_metadata.json index de488be21641..2d48b0f5987a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/_compute_management_client.py index 4938e55303b1..0bf16d5a8e04 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -55,7 +57,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-10-01". Note that overriding this default value may result in unsupported behavior. @@ -65,15 +67,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -92,7 +96,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_operations.py index b47705e440e5..097c3a5aef37 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_operations.py @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_galleries_create_or_update_request, build_galleries_delete_request, @@ -61,11 +63,8 @@ build_gallery_images_update_request, build_gallery_sharing_profile_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,10 +83,10 @@ class GalleriesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -810,10 +809,10 @@ class GalleryImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -1506,10 +1505,10 @@ class GalleryImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2284,10 +2283,10 @@ class GalleryApplicationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2992,10 +2991,10 @@ class GalleryApplicationVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -3775,10 +3774,10 @@ class GallerySharingProfileOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/_models_py3.py index b5463f665c96..90203597419d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/models/_models_py3.py @@ -161,8 +161,8 @@ def __init__( self.publisher_contact = publisher_contact self.eula = eula self.public_name_prefix = public_name_prefix - self.community_gallery_enabled = None - self.public_names = None + self.community_gallery_enabled: Optional[bool] = None + self.public_names: Optional[List[str]] = None class DiskImageEncryption(_serialization.Model): @@ -320,9 +320,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -414,10 +414,10 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.description = description self.identifier = identifier - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryPropertiesProvisioningState"]] = None self.sharing_profile = sharing_profile self.soft_delete_policy = soft_delete_policy - self.sharing_status = None + self.sharing_status: Optional["_models.SharingStatus"] = None class GalleryApplication(Resource): @@ -595,9 +595,9 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -765,8 +765,10 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None - self.replication_status = None + self.provisioning_state: Optional[ + Union[str, "_models.GalleryApplicationVersionPropertiesProvisioningState"] + ] = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryApplicationVersionList(_serialization.Model): @@ -896,7 +898,7 @@ def __init__( self.target_regions = target_regions self.replica_count = replica_count self.exclude_from_latest = exclude_from_latest - self.published_date = None + self.published_date: Optional[datetime.datetime] = None self.end_of_life_date = end_of_life_date self.storage_account_type = storage_account_type self.replication_mode = replication_mode @@ -1088,8 +1090,10 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None - self.replication_status = None + self.provisioning_state: Optional[ + Union[str, "_models.GalleryApplicationVersionPropertiesProvisioningState"] + ] = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryArtifactSource(_serialization.Model): @@ -1189,7 +1193,7 @@ def __init__( :paramtype source: ~azure.mgmt.compute.v2021_10_01.models.GalleryArtifactVersionSource """ super().__init__(**kwargs) - self.size_in_gb = None + self.size_in_gb: Optional[int] = None self.host_caching = host_caching self.source = source @@ -1302,7 +1306,7 @@ class GalleryIdentifier(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.unique_name = None + self.unique_name: Optional[str] = None class GalleryImage(Resource): @@ -1477,7 +1481,7 @@ def __init__( self.recommended = recommended self.disallowed = disallowed self.purchase_plan = purchase_plan - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImagePropertiesProvisioningState"]] = None self.features = features self.architecture = architecture @@ -1745,7 +1749,7 @@ def __init__( self.recommended = recommended self.disallowed = disallowed self.purchase_plan = purchase_plan - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImagePropertiesProvisioningState"]] = None self.features = features self.architecture = architecture @@ -1825,9 +1829,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImageVersionPropertiesProvisioningState"]] = None self.storage_profile = storage_profile - self.replication_status = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryImageVersionList(_serialization.Model): @@ -2005,9 +2009,9 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryImageVersionPropertiesProvisioningState"]] = None self.storage_profile = storage_profile - self.replication_status = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryList(_serialization.Model): @@ -2199,10 +2203,10 @@ def __init__( super().__init__(tags=tags, **kwargs) self.description = description self.identifier = identifier - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryPropertiesProvisioningState"]] = None self.sharing_profile = sharing_profile self.soft_delete_policy = soft_delete_policy - self.sharing_status = None + self.sharing_status: Optional["_models.SharingStatus"] = None class ImagePurchasePlan(_serialization.Model): @@ -2433,10 +2437,10 @@ class RegionalReplicationStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.region = None - self.state = None - self.details = None - self.progress = None + self.region: Optional[str] = None + self.state: Optional[Union[str, "_models.ReplicationState"]] = None + self.details: Optional[str] = None + self.progress: Optional[int] = None class RegionalSharingStatus(_serialization.Model): @@ -2472,7 +2476,7 @@ def __init__(self, *, region: Optional[str] = None, details: Optional[str] = Non """ super().__init__(**kwargs) self.region = region - self.state = None + self.state: Optional[Union[str, "_models.SharingState"]] = None self.details = details @@ -2502,8 +2506,8 @@ class ReplicationStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.aggregated_state = None - self.summary = None + self.aggregated_state: Optional[Union[str, "_models.AggregatedReplicationState"]] = None + self.summary: Optional[List["_models.RegionalReplicationStatus"]] = None class ResourceRange(_serialization.Model): @@ -2584,7 +2588,7 @@ def __init__( """ super().__init__(**kwargs) self.permissions = permissions - self.groups = None + self.groups: Optional[List["_models.SharingProfileGroup"]] = None self.community_gallery_info = community_gallery_info @@ -2653,7 +2657,7 @@ def __init__(self, *, summary: Optional[List["_models.RegionalSharingStatus"]] = :paramtype summary: list[~azure.mgmt.compute.v2021_10_01.models.RegionalSharingStatus] """ super().__init__(**kwargs) - self.aggregated_state = None + self.aggregated_state: Optional[Union[str, "_models.SharingState"]] = None self.summary = summary diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_operations.py index f03d8bbc5260..6309f0269bb4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +56,7 @@ def build_galleries_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -92,7 +90,7 @@ def build_galleries_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -131,7 +129,7 @@ def build_galleries_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -166,7 +164,7 @@ def build_galleries_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -197,7 +195,7 @@ def build_galleries_list_by_resource_group_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -252,7 +250,7 @@ def build_gallery_images_create_or_update_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -287,7 +285,7 @@ def build_gallery_images_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -321,7 +319,7 @@ def build_gallery_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -353,7 +351,7 @@ def build_gallery_images_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -385,7 +383,7 @@ def build_gallery_images_list_by_gallery_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -422,7 +420,7 @@ def build_gallery_image_versions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -463,7 +461,7 @@ def build_gallery_image_versions_update_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -505,7 +503,7 @@ def build_gallery_image_versions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -545,7 +543,7 @@ def build_gallery_image_versions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -578,7 +576,7 @@ def build_gallery_image_versions_list_by_gallery_image_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -611,7 +609,7 @@ def build_gallery_applications_create_or_update_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -646,7 +644,7 @@ def build_gallery_applications_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -680,7 +678,7 @@ def build_gallery_applications_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -712,7 +710,7 @@ def build_gallery_applications_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -744,7 +742,7 @@ def build_gallery_applications_list_by_gallery_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -781,7 +779,7 @@ def build_gallery_application_versions_create_or_update_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -824,7 +822,7 @@ def build_gallery_application_versions_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -868,7 +866,7 @@ def build_gallery_application_versions_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -910,7 +908,7 @@ def build_gallery_application_versions_delete_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -945,7 +943,7 @@ def build_gallery_application_versions_list_by_gallery_application_request( # p _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -978,7 +976,7 @@ def build_gallery_sharing_profile_update_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1012,10 +1010,10 @@ class GalleriesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -1732,10 +1730,10 @@ class GalleryImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -2427,10 +2425,10 @@ class GalleryImageVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -3205,10 +3203,10 @@ class GalleryApplicationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -3912,10 +3910,10 @@ class GalleryApplicationVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -4695,10 +4693,10 @@ class GallerySharingProfileOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_compute_management_client.py index 32f81e179fb8..30a831801852 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -78,7 +80,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-01-03". Note that overriding this default value may result in unsupported behavior. @@ -88,15 +90,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -115,7 +119,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_metadata.json index 8a847bf8f7a6..9c2f5a1287c2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_compute_management_client.py index 22fdc5fe351f..6a8df4d6b38a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -79,7 +81,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-01-03". Note that overriding this default value may result in unsupported behavior. @@ -89,15 +91,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -116,7 +120,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_operations.py index 861b61524139..3f61e809f119 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/aio/operations/_operations.py @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_community_galleries_get_request, build_community_gallery_image_versions_get_request, @@ -72,11 +74,8 @@ build_shared_gallery_images_get_request, build_shared_gallery_images_list_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,10 +94,10 @@ class GalleriesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -821,10 +820,10 @@ class GalleryImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -1517,10 +1516,10 @@ class GalleryImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2295,10 +2294,10 @@ class GalleryApplicationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -3003,10 +3002,10 @@ class GalleryApplicationVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -3786,10 +3785,10 @@ class GallerySharingProfileOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _update_initial( @@ -3999,10 +3998,10 @@ class SharedGalleriesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4158,10 +4157,10 @@ class SharedGalleryImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4331,10 +4330,10 @@ class SharedGalleryImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4521,10 +4520,10 @@ class CommunityGalleriesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4596,10 +4595,10 @@ class CommunityGalleryImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4760,10 +4759,10 @@ class CommunityGalleryImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/_models_py3.py index 8c8e30b76ff0..35981223a8b4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/models/_models_py3.py @@ -137,9 +137,9 @@ def __init__(self, *, unique_id: Optional[str] = None, **kwargs: Any) -> None: :paramtype unique_id: str """ super().__init__(**kwargs) - self.name = None - self.location = None - self.type = None + self.name: Optional[str] = None + self.location: Optional[str] = None + self.type: Optional[str] = None self.unique_id = unique_id @@ -515,8 +515,8 @@ def __init__( self.publisher_contact = publisher_contact self.eula = eula self.public_name_prefix = public_name_prefix - self.community_gallery_enabled = None - self.public_names = None + self.community_gallery_enabled: Optional[bool] = None + self.public_names: Optional[List[str]] = None class DiskImageEncryption(_serialization.Model): @@ -706,9 +706,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -800,10 +800,10 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.description = description self.identifier = identifier - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None self.sharing_profile = sharing_profile self.soft_delete_policy = soft_delete_policy - self.sharing_status = None + self.sharing_status: Optional["_models.SharingStatus"] = None class GalleryApplication(Resource): @@ -981,9 +981,9 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -1151,8 +1151,8 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None - self.replication_status = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryApplicationVersionList(_serialization.Model): @@ -1282,7 +1282,7 @@ def __init__( self.target_regions = target_regions self.replica_count = replica_count self.exclude_from_latest = exclude_from_latest - self.published_date = None + self.published_date: Optional[datetime.datetime] = None self.end_of_life_date = end_of_life_date self.storage_account_type = storage_account_type self.replication_mode = replication_mode @@ -1492,8 +1492,8 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None - self.replication_status = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryArtifactSource(_serialization.Model): @@ -1593,7 +1593,7 @@ def __init__( :paramtype source: ~azure.mgmt.compute.v2022_01_03.models.GalleryArtifactVersionSource """ super().__init__(**kwargs) - self.size_in_gb = None + self.size_in_gb: Optional[int] = None self.host_caching = host_caching self.source = source @@ -1706,7 +1706,7 @@ class GalleryIdentifier(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.unique_name = None + self.unique_name: Optional[str] = None class GalleryImage(Resource): @@ -1881,7 +1881,7 @@ def __init__( self.recommended = recommended self.disallowed = disallowed self.purchase_plan = purchase_plan - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None self.features = features self.architecture = architecture @@ -2149,7 +2149,7 @@ def __init__( self.recommended = recommended self.disallowed = disallowed self.purchase_plan = purchase_plan - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None self.features = features self.architecture = architecture @@ -2229,9 +2229,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None self.storage_profile = storage_profile - self.replication_status = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryImageVersionList(_serialization.Model): @@ -2409,9 +2409,9 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None self.storage_profile = storage_profile - self.replication_status = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryList(_serialization.Model): @@ -2603,10 +2603,10 @@ def __init__( super().__init__(tags=tags, **kwargs) self.description = description self.identifier = identifier - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None self.sharing_profile = sharing_profile self.soft_delete_policy = soft_delete_policy - self.sharing_status = None + self.sharing_status: Optional["_models.SharingStatus"] = None class ImagePurchasePlan(_serialization.Model): @@ -2795,8 +2795,8 @@ class PirResource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.location = None + self.name: Optional[str] = None + self.location: Optional[str] = None class PirSharedGalleryResource(PirResource): @@ -2898,10 +2898,10 @@ class RegionalReplicationStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.region = None - self.state = None - self.details = None - self.progress = None + self.region: Optional[str] = None + self.state: Optional[Union[str, "_models.ReplicationState"]] = None + self.details: Optional[str] = None + self.progress: Optional[int] = None class RegionalSharingStatus(_serialization.Model): @@ -2937,7 +2937,7 @@ def __init__(self, *, region: Optional[str] = None, details: Optional[str] = Non """ super().__init__(**kwargs) self.region = region - self.state = None + self.state: Optional[Union[str, "_models.SharingState"]] = None self.details = details @@ -2967,8 +2967,8 @@ class ReplicationStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.aggregated_state = None - self.summary = None + self.aggregated_state: Optional[Union[str, "_models.AggregatedReplicationState"]] = None + self.summary: Optional[List["_models.RegionalReplicationStatus"]] = None class ResourceRange(_serialization.Model): @@ -3043,9 +3043,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s """ super().__init__(**kwargs) self.location = location - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -3093,7 +3093,7 @@ def __init__( :paramtype host_caching: str or ~azure.mgmt.compute.v2022_01_03.models.SharedGalleryHostCaching """ super().__init__(**kwargs) - self.disk_size_gb = None + self.disk_size_gb: Optional[int] = None self.host_caching = host_caching @@ -3543,7 +3543,7 @@ def __init__( """ super().__init__(**kwargs) self.permissions = permissions - self.groups = None + self.groups: Optional[List["_models.SharingProfileGroup"]] = None self.community_gallery_info = community_gallery_info @@ -3610,7 +3610,7 @@ def __init__(self, *, summary: Optional[List["_models.RegionalSharingStatus"]] = :paramtype summary: list[~azure.mgmt.compute.v2022_01_03.models.RegionalSharingStatus] """ super().__init__(**kwargs) - self.aggregated_state = None + self.aggregated_state: Optional[Union[str, "_models.SharingState"]] = None self.summary = summary @@ -3722,7 +3722,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class TargetRegion(_serialization.Model): @@ -3930,5 +3930,5 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_operations.py index 8160171ba037..b81e2824fbe2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_01_03/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +56,7 @@ def build_galleries_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -92,7 +90,7 @@ def build_galleries_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -131,7 +129,7 @@ def build_galleries_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -166,7 +164,7 @@ def build_galleries_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -197,7 +195,7 @@ def build_galleries_list_by_resource_group_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -252,7 +250,7 @@ def build_gallery_images_create_or_update_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -287,7 +285,7 @@ def build_gallery_images_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -321,7 +319,7 @@ def build_gallery_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -353,7 +351,7 @@ def build_gallery_images_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -385,7 +383,7 @@ def build_gallery_images_list_by_gallery_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -422,7 +420,7 @@ def build_gallery_image_versions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -463,7 +461,7 @@ def build_gallery_image_versions_update_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -505,7 +503,7 @@ def build_gallery_image_versions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -545,7 +543,7 @@ def build_gallery_image_versions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -578,7 +576,7 @@ def build_gallery_image_versions_list_by_gallery_image_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -611,7 +609,7 @@ def build_gallery_applications_create_or_update_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -646,7 +644,7 @@ def build_gallery_applications_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -680,7 +678,7 @@ def build_gallery_applications_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -712,7 +710,7 @@ def build_gallery_applications_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -744,7 +742,7 @@ def build_gallery_applications_list_by_gallery_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -781,7 +779,7 @@ def build_gallery_application_versions_create_or_update_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -824,7 +822,7 @@ def build_gallery_application_versions_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -868,7 +866,7 @@ def build_gallery_application_versions_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -910,7 +908,7 @@ def build_gallery_application_versions_delete_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -945,7 +943,7 @@ def build_gallery_application_versions_list_by_gallery_application_request( # p _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -978,7 +976,7 @@ def build_gallery_sharing_profile_update_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1015,7 +1013,7 @@ def build_shared_galleries_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1047,7 +1045,7 @@ def build_shared_galleries_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1083,7 +1081,7 @@ def build_shared_gallery_images_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1116,7 +1114,7 @@ def build_shared_gallery_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1154,7 +1152,7 @@ def build_shared_gallery_image_versions_list_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1193,7 +1191,7 @@ def build_shared_gallery_image_versions_get_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1226,7 +1224,7 @@ def build_community_galleries_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1257,7 +1255,7 @@ def build_community_gallery_images_get_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1289,7 +1287,7 @@ def build_community_gallery_images_list_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1325,7 +1323,7 @@ def build_community_gallery_image_versions_get_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1358,7 +1356,7 @@ def build_community_gallery_image_versions_list_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1391,10 +1389,10 @@ class GalleriesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -2111,10 +2109,10 @@ class GalleryImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -2806,10 +2804,10 @@ class GalleryImageVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -3584,10 +3582,10 @@ class GalleryApplicationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -4291,10 +4289,10 @@ class GalleryApplicationVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -5074,10 +5072,10 @@ class GallerySharingProfileOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _update_initial( @@ -5284,10 +5282,10 @@ class SharedGalleriesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5442,10 +5440,10 @@ class SharedGalleryImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5614,10 +5612,10 @@ class SharedGalleryImageVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5804,10 +5802,10 @@ class CommunityGalleriesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5879,10 +5877,10 @@ class CommunityGalleryImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6041,10 +6039,10 @@ class CommunityGalleryImageVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_compute_management_client.py index d54fccd8a8fb..df6522a03c07 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -50,7 +52,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-03-02". Note that overriding this default value may result in unsupported behavior. @@ -60,15 +62,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -87,7 +91,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_metadata.json index 612ed3bf68ef..dda6b77270e0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/aio/_compute_management_client.py index e8a9a9110f79..c6021674bb5b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -50,7 +52,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-03-02". Note that overriding this default value may result in unsupported behavior. @@ -60,15 +62,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -87,7 +91,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/aio/operations/_operations.py index 6300a0a711a9..c1aa4aafb8ef 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/aio/operations/_operations.py @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_disk_accesses_create_or_update_request, build_disk_accesses_delete_a_private_endpoint_connection_request, @@ -72,11 +74,8 @@ build_snapshots_revoke_access_request, build_snapshots_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,10 +94,10 @@ class DisksOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -1100,10 +1099,10 @@ class DiskAccessesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2363,10 +2362,10 @@ class DiskEncryptionSetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -3190,10 +3189,10 @@ class DiskRestorePointOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3717,10 +3716,10 @@ class SnapshotsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/models/_models_py3.py index 4fa2d9bfa49c..89c1c275d63c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,8 +39,8 @@ class AccessUri(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.access_sas = None - self.security_data_access_sas = None + self.access_sas: Optional[str] = None + self.security_data_access_sas: Optional[str] = None class ApiError(_serialization.Model): @@ -281,7 +281,7 @@ def __init__( self.gallery_image_reference = gallery_image_reference self.source_uri = source_uri self.source_resource_id = source_resource_id - self.source_unique_id = None + self.source_unique_id: Optional[str] = None self.upload_size_bytes = upload_size_bytes self.logical_sector_size = logical_sector_size self.security_data_uri = security_data_uri @@ -329,9 +329,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -642,35 +642,35 @@ def __init__( # pylint: disable=too-many-locals ~azure.mgmt.compute.v2022_03_02.models.DataAccessAuthMode """ super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None - self.managed_by_extended = None + self.managed_by: Optional[str] = None + self.managed_by_extended: Optional[List[str]] = None self.sku = sku self.zones = zones self.extended_location = extended_location - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.hyper_v_generation = hyper_v_generation self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities self.creation_data = creation_data self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.unique_id = None + self.disk_size_bytes: Optional[int] = None + self.unique_id: Optional[str] = None self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.disk_iops_read_write = disk_iops_read_write self.disk_m_bps_read_write = disk_m_bps_read_write self.disk_iops_read_only = disk_iops_read_only self.disk_m_bps_read_only = disk_m_bps_read_only - self.disk_state = None + self.disk_state: Optional[Union[str, "_models.DiskState"]] = None self.encryption = encryption self.max_shares = max_shares - self.share_info = None + self.share_info: Optional[List["_models.ShareInfoElement"]] = None self.network_access_policy = network_access_policy self.disk_access_id = disk_access_id self.tier = tier self.bursting_enabled = bursting_enabled - self.property_updates_in_progress = None + self.property_updates_in_progress: Optional["_models.PropertyUpdatesInProgress"] = None self.supports_hibernation = supports_hibernation self.security_profile = security_profile self.completion_percent = completion_percent @@ -752,9 +752,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.extended_location = extended_location - self.private_endpoint_connections = None - self.provisioning_state = None - self.time_created = None + self.private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None + self.provisioning_state: Optional[str] = None + self.time_created: Optional[datetime.datetime] = None class DiskAccessList(_serialization.Model): @@ -926,11 +926,11 @@ def __init__( self.identity = identity self.encryption_type = encryption_type self.active_key = active_key - self.previous_keys = None - self.provisioning_state = None + self.previous_keys: Optional[List["_models.KeyForDiskEncryptionSet"]] = None + self.provisioning_state: Optional[str] = None self.rotation_to_latest_key_version_enabled = rotation_to_latest_key_version_enabled - self.last_key_rotation_timestamp = None - self.auto_key_rotation_error = None + self.last_key_rotation_timestamp: Optional[datetime.datetime] = None + self.auto_key_rotation_error: Optional["_models.ApiError"] = None self.federated_client_id = federated_client_id @@ -1107,9 +1107,9 @@ class ProxyOnlyResource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None class DiskRestorePoint(ProxyOnlyResource): @@ -1251,22 +1251,22 @@ def __init__( :paramtype security_profile: ~azure.mgmt.compute.v2022_03_02.models.DiskSecurityProfile """ super().__init__(**kwargs) - self.time_created = None - self.source_resource_id = None - self.os_type = None + self.time_created: Optional[datetime.datetime] = None + self.source_resource_id: Optional[str] = None + self.os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None self.hyper_v_generation = hyper_v_generation self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities - self.family_id = None - self.source_unique_id = None - self.encryption = None + self.family_id: Optional[str] = None + self.source_unique_id: Optional[str] = None + self.encryption: Optional["_models.Encryption"] = None self.supports_hibernation = supports_hibernation self.network_access_policy = network_access_policy self.public_network_access = public_network_access self.disk_access_id = disk_access_id self.completion_percent = completion_percent - self.replication_state = None - self.source_resource_location = None + self.replication_state: Optional[str] = None + self.source_resource_location: Optional[str] = None self.security_profile = security_profile @@ -1376,7 +1376,7 @@ def __init__(self, *, name: Optional[Union[str, "_models.DiskStorageAccountTypes """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class DiskUpdate(_serialization.Model): @@ -1595,7 +1595,7 @@ def __init__( self.bursting_enabled = bursting_enabled self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities - self.property_updates_in_progress = None + self.property_updates_in_progress: Optional["_models.PropertyUpdatesInProgress"] = None self.supports_hibernation = supports_hibernation self.public_network_access = public_network_access self.data_access_auth_mode = data_access_auth_mode @@ -1661,7 +1661,7 @@ class EncryptionSetIdentity(_serialization.Model): :vartype tenant_id: str :ivar user_assigned_identities: The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2022_03_02.models.UserAssignedIdentitiesValue] """ @@ -1695,14 +1695,14 @@ def __init__( :keyword user_assigned_identities: The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2022_03_02.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) self.type = type - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.user_assigned_identities = user_assigned_identities @@ -2085,7 +2085,7 @@ class PrivateEndpoint(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class PrivateEndpointConnection(_serialization.Model): @@ -2144,12 +2144,12 @@ def __init__( ~azure.mgmt.compute.v2022_03_02.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.private_endpoint = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.private_endpoint: Optional["_models.PrivateEndpoint"] = None self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None class PrivateEndpointConnectionListResult(_serialization.Model): @@ -2228,11 +2228,11 @@ def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: :paramtype required_zone_names: list[str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.group_id = None - self.required_members = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.group_id: Optional[str] = None + self.required_members: Optional[List[str]] = None self.required_zone_names = required_zone_names @@ -2450,9 +2450,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s """ super().__init__(**kwargs) self.location = location - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -2476,7 +2476,7 @@ class ShareInfoElement(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.vm_uri = None + self.vm_uri: Optional[str] = None class Snapshot(Resource): @@ -2714,21 +2714,21 @@ def __init__( # pylint: disable=too-many-locals ~azure.mgmt.compute.v2022_03_02.models.DataAccessAuthMode """ super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None + self.managed_by: Optional[str] = None self.sku = sku self.extended_location = extended_location - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.hyper_v_generation = hyper_v_generation self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities self.creation_data = creation_data self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.disk_state = None - self.unique_id = None + self.disk_size_bytes: Optional[int] = None + self.disk_state: Optional[Union[str, "_models.DiskState"]] = None + self.unique_id: Optional[str] = None self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.incremental = incremental self.encryption = encryption self.network_access_policy = network_access_policy @@ -2807,7 +2807,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class SnapshotUpdate(_serialization.Model): @@ -3007,7 +3007,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class SupportedCapabilities(_serialization.Model): @@ -3070,5 +3070,5 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/operations/_operations.py index 232570f84572..8132d41a6ba3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_02/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +56,7 @@ def build_disks_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -92,7 +90,7 @@ def build_disks_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -125,7 +123,7 @@ def build_disks_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -153,7 +151,7 @@ def build_disks_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -181,7 +179,7 @@ def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -236,7 +234,7 @@ def build_disks_grant_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -266,7 +264,7 @@ def build_disks_revoke_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -295,7 +293,7 @@ def build_disk_accesses_create_or_update_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -329,7 +327,7 @@ def build_disk_accesses_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -362,7 +360,7 @@ def build_disk_accesses_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -393,7 +391,7 @@ def build_disk_accesses_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -424,7 +422,7 @@ def build_disk_accesses_list_by_resource_group_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -478,7 +476,7 @@ def build_disk_accesses_get_private_link_resources_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -514,7 +512,7 @@ def build_disk_accesses_update_a_private_endpoint_connection_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -554,7 +552,7 @@ def build_disk_accesses_get_a_private_endpoint_connection_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -592,7 +590,7 @@ def build_disk_accesses_delete_a_private_endpoint_connection_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -626,7 +624,7 @@ def build_disk_accesses_list_private_endpoint_connections_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -658,7 +656,7 @@ def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -692,7 +690,7 @@ def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -725,7 +723,7 @@ def build_disk_encryption_sets_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -756,7 +754,7 @@ def build_disk_encryption_sets_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -787,7 +785,7 @@ def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -841,7 +839,7 @@ def build_disk_encryption_sets_list_associated_resources_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -877,7 +875,7 @@ def build_disk_restore_point_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -916,7 +914,7 @@ def build_disk_restore_point_list_by_restore_point_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -956,7 +954,7 @@ def build_disk_restore_point_grant_access_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -998,7 +996,7 @@ def build_disk_restore_point_revoke_access_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1034,7 +1032,7 @@ def build_snapshots_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1068,7 +1066,7 @@ def build_snapshots_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1101,7 +1099,7 @@ def build_snapshots_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1129,7 +1127,7 @@ def build_snapshots_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1157,7 +1155,7 @@ def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1212,7 +1210,7 @@ def build_snapshots_grant_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1242,7 +1240,7 @@ def build_snapshots_revoke_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1271,10 +1269,10 @@ class DisksOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -2269,10 +2267,10 @@ class DiskAccessesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -3520,10 +3518,10 @@ class DiskEncryptionSetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -4333,10 +4331,10 @@ class DiskRestorePointOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4856,10 +4854,10 @@ class SnapshotsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_compute_management_client.py index 42a094bf786e..f3e9d4365ebd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -52,7 +54,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-09-04". Note that overriding this default value may result in unsupported behavior. @@ -62,15 +64,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -89,7 +93,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_metadata.json index 10ccc380c3b3..ba12ad29cf4e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/aio/_compute_management_client.py index c0ea383988d9..92ea6e7eaa56 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -52,7 +54,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-09-04". Note that overriding this default value may result in unsupported behavior. @@ -62,15 +64,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -89,7 +93,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/aio/operations/_operations.py index e26b77076b8f..7cbdefad7344 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/aio/operations/_operations.py @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_cloud_service_operating_systems_get_os_family_request, build_cloud_service_operating_systems_get_os_version_request, @@ -64,11 +66,8 @@ build_cloud_services_update_domain_walk_update_domain_request, build_cloud_services_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,10 +86,10 @@ class CloudServiceRoleInstancesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_initial( @@ -830,10 +829,10 @@ class CloudServiceRolesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -994,10 +993,10 @@ class CloudServicesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2731,10 +2730,10 @@ class CloudServicesUpdateDomainOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _walk_update_domain_initial( @@ -3101,10 +3100,10 @@ class CloudServiceOperatingSystemsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/models/_models_py3.py index ccd90f904ab9..78a2f67c1442 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/models/_models_py3.py @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ApiError(_serialization.Model): @@ -177,9 +172,9 @@ def __init__( :paramtype zones: list[str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags self.properties = properties @@ -337,7 +332,7 @@ def __init__( self.protected_settings = protected_settings self.protected_settings_from_key_vault = protected_settings_from_key_vault self.force_update_tag = force_update_tag - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.roles_applied_to = roles_applied_to @@ -379,9 +374,9 @@ def __init__(self, *, role_instance: Optional["_models.InstanceViewStatusesSumma """ super().__init__(**kwargs) self.role_instance = role_instance - self.sdk_version = None - self.private_ids = None - self.statuses = None + self.sdk_version: Optional[str] = None + self.private_ids: Optional[List[str]] = None + self.statuses: Optional[List["_models.ResourceInstanceViewStatus"]] = None class CloudServiceListResult(_serialization.Model): @@ -642,8 +637,8 @@ def __init__( self.os_profile = os_profile self.network_profile = network_profile self.extension_profile = extension_profile - self.provisioning_state = None - self.unique_id = None + self.provisioning_state: Optional[str] = None + self.unique_id: Optional[str] = None class CloudServiceRole(_serialization.Model): @@ -695,10 +690,10 @@ def __init__( :paramtype properties: ~azure.mgmt.compute.v2022_09_04.models.CloudServiceRoleProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location: Optional[str] = None self.sku = sku self.properties = properties @@ -810,7 +805,7 @@ class CloudServiceRoleProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.unique_id = None + self.unique_id: Optional[str] = None class CloudServiceRoleSku(_serialization.Model): @@ -1079,8 +1074,8 @@ class InstanceSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.tier = None + self.name: Optional[str] = None + self.tier: Optional[str] = None class InstanceViewStatusesSummary(_serialization.Model): @@ -1103,7 +1098,7 @@ class InstanceViewStatusesSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.statuses_summary = None + self.statuses_summary: Optional[List["_models.StatusCodeCount"]] = None class LoadBalancerConfiguration(_serialization.Model): @@ -1309,10 +1304,10 @@ def __init__(self, *, properties: Optional["_models.OSFamilyProperties"] = None, :paramtype properties: ~azure.mgmt.compute.v2022_09_04.models.OSFamilyProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location: Optional[str] = None self.properties = properties @@ -1378,9 +1373,9 @@ class OSFamilyProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.label = None - self.versions = None + self.name: Optional[str] = None + self.label: Optional[str] = None + self.versions: Optional[List["_models.OSVersionPropertiesBase"]] = None class OSVersion(_serialization.Model): @@ -1421,10 +1416,10 @@ def __init__(self, *, properties: Optional["_models.OSVersionProperties"] = None :paramtype properties: ~azure.mgmt.compute.v2022_09_04.models.OSVersionProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location: Optional[str] = None self.properties = properties @@ -1502,12 +1497,12 @@ class OSVersionProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.family = None - self.family_label = None - self.version = None - self.label = None - self.is_default = None - self.is_active = None + self.family: Optional[str] = None + self.family_label: Optional[str] = None + self.version: Optional[str] = None + self.label: Optional[str] = None + self.is_default: Optional[bool] = None + self.is_active: Optional[bool] = None class OSVersionPropertiesBase(_serialization.Model): @@ -1542,10 +1537,10 @@ class OSVersionPropertiesBase(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.version = None - self.label = None - self.is_default = None - self.is_active = None + self.version: Optional[str] = None + self.label: Optional[str] = None + self.is_default: Optional[bool] = None + self.is_active: Optional[bool] = None class Resource(_serialization.Model): @@ -1590,9 +1585,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1635,10 +1630,10 @@ def __init__(self, *, level: Optional[Union[str, "_models.StatusLevelTypes"]] = :paramtype level: str or ~azure.mgmt.compute.v2022_09_04.models.StatusLevelTypes """ super().__init__(**kwargs) - self.code = None - self.display_status = None - self.message = None - self.time = None + self.code: Optional[str] = None + self.display_status: Optional[str] = None + self.message: Optional[str] = None + self.time: Optional[datetime.datetime] = None self.level = level @@ -1682,9 +1677,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s """ super().__init__(**kwargs) self.location = location - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -1741,11 +1736,11 @@ def __init__( :paramtype properties: ~azure.mgmt.compute.v2022_09_04.models.RoleInstanceProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location: Optional[str] = None + self.tags: Optional[Dict[str, str]] = None self.sku = sku self.properties = properties @@ -1805,7 +1800,7 @@ class RoleInstanceNetworkProfile(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.network_interfaces = None + self.network_interfaces: Optional[List["_models.SubResource"]] = None class RoleInstanceProperties(_serialization.Model): @@ -1902,10 +1897,10 @@ class RoleInstanceView(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.platform_update_domain = None - self.platform_fault_domain = None - self.private_id = None - self.statuses = None + self.platform_update_domain: Optional[int] = None + self.platform_fault_domain: Optional[int] = None + self.private_id: Optional[str] = None + self.statuses: Optional[List["_models.ResourceInstanceViewStatus"]] = None class StatusCodeCount(_serialization.Model): @@ -1932,8 +1927,8 @@ class StatusCodeCount(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.count = None + self.code: Optional[str] = None + self.count: Optional[int] = None class SubResource(_serialization.Model): @@ -1976,7 +1971,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class SystemData(_serialization.Model): @@ -2005,8 +2000,8 @@ class SystemData(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.created_at = None - self.last_modified_at = None + self.created_at: Optional[datetime.datetime] = None + self.last_modified_at: Optional[datetime.datetime] = None class UpdateDomain(_serialization.Model): @@ -2033,8 +2028,8 @@ class UpdateDomain(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None + self.id: Optional[str] = None + self.name: Optional[str] = None class UpdateDomainListResult(_serialization.Model): @@ -2095,5 +2090,5 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/operations/_operations.py index d7547dfd53cc..90da6ad3a6c6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_09_04/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +55,7 @@ def build_cloud_service_role_instances_delete_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -95,7 +93,7 @@ def build_cloud_service_role_instances_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -129,7 +127,7 @@ def build_cloud_service_role_instances_get_instance_view_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -166,7 +164,7 @@ def build_cloud_service_role_instances_list_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -199,7 +197,7 @@ def build_cloud_service_role_instances_restart_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -231,7 +229,7 @@ def build_cloud_service_role_instances_reimage_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -263,7 +261,7 @@ def build_cloud_service_role_instances_rebuild_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -295,7 +293,7 @@ def build_cloud_service_role_instances_get_remote_desktop_file_request( # pylin _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -327,7 +325,7 @@ def build_cloud_service_roles_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleName": _SERIALIZER.url("role_name", role_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -359,7 +357,7 @@ def build_cloud_service_roles_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -391,7 +389,7 @@ def build_cloud_services_create_or_update_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -425,7 +423,7 @@ def build_cloud_services_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -458,7 +456,7 @@ def build_cloud_services_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -489,7 +487,7 @@ def build_cloud_services_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -520,7 +518,7 @@ def build_cloud_services_get_instance_view_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -573,7 +571,7 @@ def build_cloud_services_list_request(resource_group_name: str, subscription_id: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -603,7 +601,7 @@ def build_cloud_services_start_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -634,7 +632,7 @@ def build_cloud_services_power_off_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -666,7 +664,7 @@ def build_cloud_services_restart_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -700,7 +698,7 @@ def build_cloud_services_reimage_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -734,7 +732,7 @@ def build_cloud_services_rebuild_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -768,7 +766,7 @@ def build_cloud_services_delete_instances_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -802,7 +800,7 @@ def build_cloud_services_update_domain_walk_update_domain_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -836,7 +834,7 @@ def build_cloud_services_update_domain_get_update_domain_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -868,7 +866,7 @@ def build_cloud_services_update_domain_list_update_domains_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -899,7 +897,7 @@ def build_cloud_service_operating_systems_get_os_version_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "osVersionName": _SERIALIZER.url("os_version_name", os_version_name, "str"), @@ -930,7 +928,7 @@ def build_cloud_service_operating_systems_list_os_versions_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -960,7 +958,7 @@ def build_cloud_service_operating_systems_get_os_family_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "osFamilyName": _SERIALIZER.url("os_family_name", os_family_name, "str"), @@ -991,7 +989,7 @@ def build_cloud_service_operating_systems_list_os_families_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1022,10 +1020,10 @@ class CloudServiceRoleInstancesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_initial( @@ -1764,10 +1762,10 @@ class CloudServiceRolesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1927,10 +1925,10 @@ class CloudServicesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -3650,10 +3648,10 @@ class CloudServicesUpdateDomainOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _walk_update_domain_initial( @@ -4019,10 +4017,10 @@ class CloudServiceOperatingSystemsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_compute_management_client.py index 97c19fdb7351..24e1c624e1e8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -50,7 +52,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2023-04-02". Note that overriding this default value may result in unsupported behavior. @@ -60,15 +62,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -87,7 +91,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_metadata.json index 4776fb19f2c0..1dd19c885cbe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/aio/_compute_management_client.py index e5da64091524..64836e0ba15c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -50,7 +52,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2023-04-02". Note that overriding this default value may result in unsupported behavior. @@ -60,15 +62,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -87,7 +91,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/aio/operations/_operations.py index b81daa235b68..f12c2d3339b9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/aio/operations/_operations.py @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_disk_accesses_create_or_update_request, build_disk_accesses_delete_a_private_endpoint_connection_request, @@ -72,11 +74,8 @@ build_snapshots_revoke_access_request, build_snapshots_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,10 +94,10 @@ class DisksOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -1100,10 +1099,10 @@ class DiskAccessesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2363,10 +2362,10 @@ class DiskEncryptionSetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -3190,10 +3189,10 @@ class DiskRestorePointOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3717,10 +3716,10 @@ class SnapshotsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/models/_models_py3.py index fd53eafe1ec6..04f7965c7b3c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,8 +39,8 @@ class AccessUri(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.access_sas = None - self.security_data_access_sas = None + self.access_sas: Optional[str] = None + self.security_data_access_sas: Optional[str] = None class ApiError(_serialization.Model): @@ -299,7 +299,7 @@ def __init__( self.gallery_image_reference = gallery_image_reference self.source_uri = source_uri self.source_resource_id = source_resource_id - self.source_unique_id = None + self.source_unique_id: Optional[str] = None self.upload_size_bytes = upload_size_bytes self.logical_sector_size = logical_sector_size self.security_data_uri = security_data_uri @@ -349,9 +349,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -686,43 +686,43 @@ def __init__( # pylint: disable=too-many-locals :paramtype optimized_for_frequent_attach: bool """ super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None - self.managed_by_extended = None + self.managed_by: Optional[str] = None + self.managed_by_extended: Optional[List[str]] = None self.sku = sku self.zones = zones self.extended_location = extended_location - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.hyper_v_generation = hyper_v_generation self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities self.creation_data = creation_data self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.unique_id = None + self.disk_size_bytes: Optional[int] = None + self.unique_id: Optional[str] = None self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.disk_iops_read_write = disk_iops_read_write self.disk_m_bps_read_write = disk_m_bps_read_write self.disk_iops_read_only = disk_iops_read_only self.disk_m_bps_read_only = disk_m_bps_read_only - self.disk_state = None + self.disk_state: Optional[Union[str, "_models.DiskState"]] = None self.encryption = encryption self.max_shares = max_shares - self.share_info = None + self.share_info: Optional[List["_models.ShareInfoElement"]] = None self.network_access_policy = network_access_policy self.disk_access_id = disk_access_id - self.bursting_enabled_time = None + self.bursting_enabled_time: Optional[datetime.datetime] = None self.tier = tier self.bursting_enabled = bursting_enabled - self.property_updates_in_progress = None + self.property_updates_in_progress: Optional["_models.PropertyUpdatesInProgress"] = None self.supports_hibernation = supports_hibernation self.security_profile = security_profile self.completion_percent = completion_percent self.public_network_access = public_network_access self.data_access_auth_mode = data_access_auth_mode self.optimized_for_frequent_attach = optimized_for_frequent_attach - self.last_ownership_update_time = None + self.last_ownership_update_time: Optional[datetime.datetime] = None class DiskAccess(Resource): @@ -799,9 +799,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.extended_location = extended_location - self.private_endpoint_connections = None - self.provisioning_state = None - self.time_created = None + self.private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None + self.provisioning_state: Optional[str] = None + self.time_created: Optional[datetime.datetime] = None class DiskAccessList(_serialization.Model): @@ -973,11 +973,11 @@ def __init__( self.identity = identity self.encryption_type = encryption_type self.active_key = active_key - self.previous_keys = None - self.provisioning_state = None + self.previous_keys: Optional[List["_models.KeyForDiskEncryptionSet"]] = None + self.provisioning_state: Optional[str] = None self.rotation_to_latest_key_version_enabled = rotation_to_latest_key_version_enabled - self.last_key_rotation_timestamp = None - self.auto_key_rotation_error = None + self.last_key_rotation_timestamp: Optional[datetime.datetime] = None + self.auto_key_rotation_error: Optional["_models.ApiError"] = None self.federated_client_id = federated_client_id @@ -1154,9 +1154,9 @@ class ProxyOnlyResource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None class DiskRestorePoint(ProxyOnlyResource): @@ -1298,22 +1298,22 @@ def __init__( :paramtype security_profile: ~azure.mgmt.compute.v2023_04_02.models.DiskSecurityProfile """ super().__init__(**kwargs) - self.time_created = None - self.source_resource_id = None - self.os_type = None + self.time_created: Optional[datetime.datetime] = None + self.source_resource_id: Optional[str] = None + self.os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None self.hyper_v_generation = hyper_v_generation self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities - self.family_id = None - self.source_unique_id = None - self.encryption = None + self.family_id: Optional[str] = None + self.source_unique_id: Optional[str] = None + self.encryption: Optional["_models.Encryption"] = None self.supports_hibernation = supports_hibernation self.network_access_policy = network_access_policy self.public_network_access = public_network_access self.disk_access_id = disk_access_id self.completion_percent = completion_percent - self.replication_state = None - self.source_resource_location = None + self.replication_state: Optional[str] = None + self.source_resource_location: Optional[str] = None self.security_profile = security_profile @@ -1423,7 +1423,7 @@ def __init__(self, *, name: Optional[Union[str, "_models.DiskStorageAccountTypes """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class DiskUpdate(_serialization.Model): @@ -1656,7 +1656,7 @@ def __init__( self.bursting_enabled = bursting_enabled self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities - self.property_updates_in_progress = None + self.property_updates_in_progress: Optional["_models.PropertyUpdatesInProgress"] = None self.supports_hibernation = supports_hibernation self.public_network_access = public_network_access self.data_access_auth_mode = data_access_auth_mode @@ -1723,7 +1723,7 @@ class EncryptionSetIdentity(_serialization.Model): :vartype tenant_id: str :ivar user_assigned_identities: The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2023_04_02.models.UserAssignedIdentitiesValue] """ @@ -1757,14 +1757,14 @@ def __init__( :keyword user_assigned_identities: The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2023_04_02.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) self.type = type - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.user_assigned_identities = user_assigned_identities @@ -2156,7 +2156,7 @@ class PrivateEndpoint(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class PrivateEndpointConnection(_serialization.Model): @@ -2215,12 +2215,12 @@ def __init__( ~azure.mgmt.compute.v2023_04_02.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.private_endpoint = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.private_endpoint: Optional["_models.PrivateEndpoint"] = None self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None class PrivateEndpointConnectionListResult(_serialization.Model): @@ -2299,11 +2299,11 @@ def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: :paramtype required_zone_names: list[str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.group_id = None - self.required_members = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.group_id: Optional[str] = None + self.required_members: Optional[List[str]] = None self.required_zone_names = required_zone_names @@ -2521,9 +2521,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s """ super().__init__(**kwargs) self.location = location - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -2547,7 +2547,7 @@ class ShareInfoElement(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.vm_uri = None + self.vm_uri: Optional[str] = None class Snapshot(Resource): @@ -2791,23 +2791,23 @@ def __init__( # pylint: disable=too-many-locals ~azure.mgmt.compute.v2023_04_02.models.DataAccessAuthMode """ super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None + self.managed_by: Optional[str] = None self.sku = sku self.extended_location = extended_location - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.hyper_v_generation = hyper_v_generation self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities self.creation_data = creation_data self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.disk_state = None - self.unique_id = None + self.disk_size_bytes: Optional[int] = None + self.disk_state: Optional[Union[str, "_models.DiskState"]] = None + self.unique_id: Optional[str] = None self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.incremental = incremental - self.incremental_snapshot_family_id = None + self.incremental_snapshot_family_id: Optional[str] = None self.encryption = encryption self.network_access_policy = network_access_policy self.disk_access_id = disk_access_id @@ -2885,7 +2885,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class SnapshotUpdate(_serialization.Model): @@ -3085,7 +3085,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class SupportedCapabilities(_serialization.Model): @@ -3159,8 +3159,8 @@ class SystemData(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.created_at = None - self.last_modified_at = None + self.created_at: Optional[datetime.datetime] = None + self.last_modified_at: Optional[datetime.datetime] = None class UserAssignedIdentitiesValue(_serialization.Model): @@ -3187,5 +3187,5 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/operations/_operations.py index eb8c1b2d4631..fd3a15989622 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_04_02/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +56,7 @@ def build_disks_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -92,7 +90,7 @@ def build_disks_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -125,7 +123,7 @@ def build_disks_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -153,7 +151,7 @@ def build_disks_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -181,7 +179,7 @@ def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -236,7 +234,7 @@ def build_disks_grant_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -266,7 +264,7 @@ def build_disks_revoke_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -295,7 +293,7 @@ def build_disk_accesses_create_or_update_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -329,7 +327,7 @@ def build_disk_accesses_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -362,7 +360,7 @@ def build_disk_accesses_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -393,7 +391,7 @@ def build_disk_accesses_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -424,7 +422,7 @@ def build_disk_accesses_list_by_resource_group_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -478,7 +476,7 @@ def build_disk_accesses_get_private_link_resources_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -514,7 +512,7 @@ def build_disk_accesses_update_a_private_endpoint_connection_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -554,7 +552,7 @@ def build_disk_accesses_get_a_private_endpoint_connection_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -592,7 +590,7 @@ def build_disk_accesses_delete_a_private_endpoint_connection_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -626,7 +624,7 @@ def build_disk_accesses_list_private_endpoint_connections_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -658,7 +656,7 @@ def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -692,7 +690,7 @@ def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -725,7 +723,7 @@ def build_disk_encryption_sets_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -756,7 +754,7 @@ def build_disk_encryption_sets_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -787,7 +785,7 @@ def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -841,7 +839,7 @@ def build_disk_encryption_sets_list_associated_resources_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -877,7 +875,7 @@ def build_disk_restore_point_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -916,7 +914,7 @@ def build_disk_restore_point_list_by_restore_point_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -956,7 +954,7 @@ def build_disk_restore_point_grant_access_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -998,7 +996,7 @@ def build_disk_restore_point_revoke_access_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1034,7 +1032,7 @@ def build_snapshots_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1068,7 +1066,7 @@ def build_snapshots_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1101,7 +1099,7 @@ def build_snapshots_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1129,7 +1127,7 @@ def build_snapshots_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1157,7 +1155,7 @@ def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1212,7 +1210,7 @@ def build_snapshots_grant_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1242,7 +1240,7 @@ def build_snapshots_revoke_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1271,10 +1269,10 @@ class DisksOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -2269,10 +2267,10 @@ class DiskAccessesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -3520,10 +3518,10 @@ class DiskEncryptionSetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -4333,10 +4331,10 @@ class DiskRestorePointOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4856,10 +4854,10 @@ class SnapshotsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_compute_management_client.py index 719ce120eb3f..a03896f3b580 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -78,7 +80,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2023-07-03". Note that overriding this default value may result in unsupported behavior. @@ -88,15 +90,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -115,7 +119,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_metadata.json index f6fbea438a5d..e816c3aa9147 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_compute_management_client.py index 4e35f9b73058..0d0bcb07571c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -79,7 +81,7 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2023-07-03". Note that overriding this default value may result in unsupported behavior. @@ -89,15 +91,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -116,7 +120,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_operations.py index e0720ea80b01..f39730fc5b1e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/aio/operations/_operations.py @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_community_galleries_get_request, build_community_gallery_image_versions_get_request, @@ -72,11 +74,8 @@ build_shared_gallery_images_get_request, build_shared_gallery_images_list_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,10 +94,10 @@ class GalleriesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -821,10 +820,10 @@ class GalleryImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -1517,10 +1516,10 @@ class GalleryImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2295,10 +2294,10 @@ class GalleryApplicationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -3003,10 +3002,10 @@ class GalleryApplicationVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -3786,10 +3785,10 @@ class GallerySharingProfileOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _update_initial( @@ -3999,10 +3998,10 @@ class SharedGalleriesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4158,10 +4157,10 @@ class SharedGalleryImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4331,10 +4330,10 @@ class SharedGalleryImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4521,10 +4520,10 @@ class CommunityGalleriesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4596,10 +4595,10 @@ class CommunityGalleryImagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4760,10 +4759,10 @@ class CommunityGalleryImageVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_models_py3.py index aea884089634..1c0e05f201ab 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/models/_models_py3.py @@ -137,9 +137,9 @@ def __init__(self, *, unique_id: Optional[str] = None, **kwargs: Any) -> None: :paramtype unique_id: str """ super().__init__(**kwargs) - self.name = None - self.location = None - self.type = None + self.name: Optional[str] = None + self.location: Optional[str] = None + self.type: Optional[str] = None self.unique_id = unique_id @@ -621,8 +621,8 @@ def __init__( self.publisher_contact = publisher_contact self.eula = eula self.public_name_prefix = public_name_prefix - self.community_gallery_enabled = None - self.public_names = None + self.community_gallery_enabled: Optional[bool] = None + self.public_names: Optional[List[str]] = None class CommunityGalleryMetadata(_serialization.Model): @@ -874,9 +874,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -968,10 +968,10 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.description = description self.identifier = identifier - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None self.sharing_profile = sharing_profile self.soft_delete_policy = soft_delete_policy - self.sharing_status = None + self.sharing_status: Optional["_models.SharingStatus"] = None class GalleryApplication(Resource): @@ -1284,9 +1284,9 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -1472,8 +1472,8 @@ def __init__( super().__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile self.safety_profile = safety_profile - self.provisioning_state = None - self.replication_status = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryApplicationVersionList(_serialization.Model): @@ -1603,7 +1603,7 @@ def __init__( self.target_regions = target_regions self.replica_count = replica_count self.exclude_from_latest = exclude_from_latest - self.published_date = None + self.published_date: Optional[datetime.datetime] = None self.end_of_life_date = end_of_life_date self.storage_account_type = storage_account_type self.replication_mode = replication_mode @@ -1864,8 +1864,8 @@ def __init__( super().__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile self.safety_profile = safety_profile - self.provisioning_state = None - self.replication_status = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None + self.replication_status: Optional["_models.ReplicationStatus"] = None class GalleryArtifactSource(_serialization.Model): @@ -1995,7 +1995,7 @@ def __init__( :paramtype source: ~azure.mgmt.compute.v2023_07_03.models.GalleryDiskImageSource """ super().__init__(**kwargs) - self.size_in_gb = None + self.size_in_gb: Optional[int] = None self.host_caching = host_caching self.source = source @@ -2150,7 +2150,7 @@ class GalleryIdentifier(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.unique_name = None + self.unique_name: Optional[str] = None class GalleryImage(Resource): @@ -2323,7 +2323,7 @@ def __init__( self.recommended = recommended self.disallowed = disallowed self.purchase_plan = purchase_plan - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None self.features = features self.architecture = architecture @@ -2589,7 +2589,7 @@ def __init__( self.recommended = recommended self.disallowed = disallowed self.purchase_plan = purchase_plan - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None self.features = features self.architecture = architecture @@ -2683,10 +2683,10 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None self.storage_profile = storage_profile self.safety_profile = safety_profile - self.replication_status = None + self.replication_status: Optional["_models.ReplicationStatus"] = None self.security_profile = security_profile @@ -2794,8 +2794,8 @@ def __init__(self, *, allow_deletion_of_replicated_locations: Optional[bool] = N :paramtype allow_deletion_of_replicated_locations: bool """ super().__init__(allow_deletion_of_replicated_locations=allow_deletion_of_replicated_locations, **kwargs) - self.reported_for_policy_violation = None - self.policy_violations = None + self.reported_for_policy_violation: Optional[bool] = None + self.policy_violations: Optional[List["_models.PolicyViolation"]] = None class GalleryImageVersionStorageProfile(_serialization.Model): @@ -2955,10 +2955,10 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.publishing_profile = publishing_profile - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None self.storage_profile = storage_profile self.safety_profile = safety_profile - self.replication_status = None + self.replication_status: Optional["_models.ReplicationStatus"] = None self.security_profile = security_profile @@ -3152,10 +3152,10 @@ def __init__( super().__init__(tags=tags, **kwargs) self.description = description self.identifier = identifier - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.GalleryProvisioningState"]] = None self.sharing_profile = sharing_profile self.soft_delete_policy = soft_delete_policy - self.sharing_status = None + self.sharing_status: Optional["_models.SharingStatus"] = None class ImagePurchasePlan(_serialization.Model): @@ -3397,8 +3397,8 @@ class PirResource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.location = None + self.name: Optional[str] = None + self.location: Optional[str] = None class PirSharedGalleryResource(PirResource): @@ -3534,10 +3534,10 @@ class RegionalReplicationStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.region = None - self.state = None - self.details = None - self.progress = None + self.region: Optional[str] = None + self.state: Optional[Union[str, "_models.ReplicationState"]] = None + self.details: Optional[str] = None + self.progress: Optional[int] = None class RegionalSharingStatus(_serialization.Model): @@ -3573,7 +3573,7 @@ def __init__(self, *, region: Optional[str] = None, details: Optional[str] = Non """ super().__init__(**kwargs) self.region = region - self.state = None + self.state: Optional[Union[str, "_models.SharingState"]] = None self.details = details @@ -3603,8 +3603,8 @@ class ReplicationStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.aggregated_state = None - self.summary = None + self.aggregated_state: Optional[Union[str, "_models.AggregatedReplicationState"]] = None + self.summary: Optional[List["_models.RegionalReplicationStatus"]] = None class ResourceRange(_serialization.Model): @@ -3679,9 +3679,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s """ super().__init__(**kwargs) self.location = location - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -3719,7 +3719,7 @@ def __init__(self, *, unique_id: Optional[str] = None, **kwargs: Any) -> None: :paramtype unique_id: str """ super().__init__(unique_id=unique_id, **kwargs) - self.artifact_tags = None + self.artifact_tags: Optional[Dict[str, str]] = None class SharedGalleryDiskImage(_serialization.Model): @@ -3752,7 +3752,7 @@ def __init__( :paramtype host_caching: str or ~azure.mgmt.compute.v2023_07_03.models.SharedGalleryHostCaching """ super().__init__(**kwargs) - self.disk_size_gb = None + self.disk_size_gb: Optional[int] = None self.host_caching = host_caching @@ -4226,7 +4226,7 @@ def __init__( """ super().__init__(**kwargs) self.permissions = permissions - self.groups = None + self.groups: Optional[List["_models.SharingProfileGroup"]] = None self.community_gallery_info = community_gallery_info @@ -4291,7 +4291,7 @@ def __init__(self, *, summary: Optional[List["_models.RegionalSharingStatus"]] = :paramtype summary: list[~azure.mgmt.compute.v2023_07_03.models.RegionalSharingStatus] """ super().__init__(**kwargs) - self.aggregated_state = None + self.aggregated_state: Optional[Union[str, "_models.SharingState"]] = None self.summary = summary @@ -4401,7 +4401,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class SystemData(_serialization.Model): @@ -4430,8 +4430,8 @@ class SystemData(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.created_at = None - self.last_modified_at = None + self.created_at: Optional[datetime.datetime] = None + self.last_modified_at: Optional[datetime.datetime] = None class TargetRegion(_serialization.Model): @@ -4727,5 +4727,5 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_operations.py index b614a48c80d5..e7d0819a0fae 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_03/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +56,7 @@ def build_galleries_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -92,7 +90,7 @@ def build_galleries_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -131,7 +129,7 @@ def build_galleries_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -166,7 +164,7 @@ def build_galleries_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -197,7 +195,7 @@ def build_galleries_list_by_resource_group_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -252,7 +250,7 @@ def build_gallery_images_create_or_update_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -287,7 +285,7 @@ def build_gallery_images_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -321,7 +319,7 @@ def build_gallery_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -353,7 +351,7 @@ def build_gallery_images_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -385,7 +383,7 @@ def build_gallery_images_list_by_gallery_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -422,7 +420,7 @@ def build_gallery_image_versions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -463,7 +461,7 @@ def build_gallery_image_versions_update_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -505,7 +503,7 @@ def build_gallery_image_versions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -545,7 +543,7 @@ def build_gallery_image_versions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -578,7 +576,7 @@ def build_gallery_image_versions_list_by_gallery_image_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -611,7 +609,7 @@ def build_gallery_applications_create_or_update_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -646,7 +644,7 @@ def build_gallery_applications_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -680,7 +678,7 @@ def build_gallery_applications_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -712,7 +710,7 @@ def build_gallery_applications_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -744,7 +742,7 @@ def build_gallery_applications_list_by_gallery_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -781,7 +779,7 @@ def build_gallery_application_versions_create_or_update_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -824,7 +822,7 @@ def build_gallery_application_versions_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -868,7 +866,7 @@ def build_gallery_application_versions_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -910,7 +908,7 @@ def build_gallery_application_versions_delete_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -945,7 +943,7 @@ def build_gallery_application_versions_list_by_gallery_application_request( # p _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -978,7 +976,7 @@ def build_gallery_sharing_profile_update_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1015,7 +1013,7 @@ def build_shared_galleries_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1047,7 +1045,7 @@ def build_shared_galleries_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1083,7 +1081,7 @@ def build_shared_gallery_images_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1116,7 +1114,7 @@ def build_shared_gallery_images_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1154,7 +1152,7 @@ def build_shared_gallery_image_versions_list_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1193,7 +1191,7 @@ def build_shared_gallery_image_versions_get_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1226,7 +1224,7 @@ def build_community_galleries_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1257,7 +1255,7 @@ def build_community_gallery_images_get_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1289,7 +1287,7 @@ def build_community_gallery_images_list_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1325,7 +1323,7 @@ def build_community_gallery_image_versions_get_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1358,7 +1356,7 @@ def build_community_gallery_image_versions_list_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), @@ -1391,10 +1389,10 @@ class GalleriesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -2111,10 +2109,10 @@ class GalleryImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -2806,10 +2804,10 @@ class GalleryImageVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -3584,10 +3582,10 @@ class GalleryApplicationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -4291,10 +4289,10 @@ class GalleryApplicationVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -5074,10 +5072,10 @@ class GallerySharingProfileOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _update_initial( @@ -5284,10 +5282,10 @@ class SharedGalleriesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5442,10 +5440,10 @@ class SharedGalleryImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5614,10 +5612,10 @@ class SharedGalleryImageVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5804,10 +5802,10 @@ class CommunityGalleriesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5879,10 +5877,10 @@ class CommunityGalleryImagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6041,10 +6039,10 @@ class CommunityGalleryImageVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_compute_management_client.py index 47d2935c9ecc..b0ec506d4193 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -50,7 +52,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2023-10-02". Note that overriding this default value may result in unsupported behavior. @@ -60,15 +62,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -87,7 +91,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_metadata.json index d15485ab1886..4656f6df15a5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/aio/_compute_management_client.py index 54a43c67a6bd..b31acfc24510 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -50,7 +52,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2023-10-02". Note that overriding this default value may result in unsupported behavior. @@ -60,15 +62,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -87,7 +91,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/aio/operations/_operations.py index 764e0e5df4ac..3ae62b0aeb77 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/aio/operations/_operations.py @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_disk_accesses_create_or_update_request, build_disk_accesses_delete_a_private_endpoint_connection_request, @@ -72,11 +74,8 @@ build_snapshots_revoke_access_request, build_snapshots_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,10 +94,10 @@ class DisksOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -1100,10 +1099,10 @@ class DiskAccessesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2363,10 +2362,10 @@ class DiskEncryptionSetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -3190,10 +3189,10 @@ class DiskRestorePointOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3717,10 +3716,10 @@ class SnapshotsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/models/_models_py3.py index 878aebb20037..119016a84cb9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,8 +39,8 @@ class AccessUri(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.access_sas = None - self.security_data_access_sas = None + self.access_sas: Optional[str] = None + self.security_data_access_sas: Optional[str] = None class ApiError(_serialization.Model): @@ -311,7 +311,7 @@ def __init__( self.gallery_image_reference = gallery_image_reference self.source_uri = source_uri self.source_resource_id = source_resource_id - self.source_unique_id = None + self.source_unique_id: Optional[str] = None self.upload_size_bytes = upload_size_bytes self.logical_sector_size = logical_sector_size self.security_data_uri = security_data_uri @@ -362,9 +362,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -699,43 +699,43 @@ def __init__( # pylint: disable=too-many-locals :paramtype optimized_for_frequent_attach: bool """ super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None - self.managed_by_extended = None + self.managed_by: Optional[str] = None + self.managed_by_extended: Optional[List[str]] = None self.sku = sku self.zones = zones self.extended_location = extended_location - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.hyper_v_generation = hyper_v_generation self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities self.creation_data = creation_data self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.unique_id = None + self.disk_size_bytes: Optional[int] = None + self.unique_id: Optional[str] = None self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.disk_iops_read_write = disk_iops_read_write self.disk_m_bps_read_write = disk_m_bps_read_write self.disk_iops_read_only = disk_iops_read_only self.disk_m_bps_read_only = disk_m_bps_read_only - self.disk_state = None + self.disk_state: Optional[Union[str, "_models.DiskState"]] = None self.encryption = encryption self.max_shares = max_shares - self.share_info = None + self.share_info: Optional[List["_models.ShareInfoElement"]] = None self.network_access_policy = network_access_policy self.disk_access_id = disk_access_id - self.bursting_enabled_time = None + self.bursting_enabled_time: Optional[datetime.datetime] = None self.tier = tier self.bursting_enabled = bursting_enabled - self.property_updates_in_progress = None + self.property_updates_in_progress: Optional["_models.PropertyUpdatesInProgress"] = None self.supports_hibernation = supports_hibernation self.security_profile = security_profile self.completion_percent = completion_percent self.public_network_access = public_network_access self.data_access_auth_mode = data_access_auth_mode self.optimized_for_frequent_attach = optimized_for_frequent_attach - self.last_ownership_update_time = None + self.last_ownership_update_time: Optional[datetime.datetime] = None class DiskAccess(Resource): @@ -812,9 +812,9 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.extended_location = extended_location - self.private_endpoint_connections = None - self.provisioning_state = None - self.time_created = None + self.private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None + self.provisioning_state: Optional[str] = None + self.time_created: Optional[datetime.datetime] = None class DiskAccessList(_serialization.Model): @@ -986,11 +986,11 @@ def __init__( self.identity = identity self.encryption_type = encryption_type self.active_key = active_key - self.previous_keys = None - self.provisioning_state = None + self.previous_keys: Optional[List["_models.KeyForDiskEncryptionSet"]] = None + self.provisioning_state: Optional[str] = None self.rotation_to_latest_key_version_enabled = rotation_to_latest_key_version_enabled - self.last_key_rotation_timestamp = None - self.auto_key_rotation_error = None + self.last_key_rotation_timestamp: Optional[datetime.datetime] = None + self.auto_key_rotation_error: Optional["_models.ApiError"] = None self.federated_client_id = federated_client_id @@ -1167,9 +1167,9 @@ class ProxyOnlyResource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None class DiskRestorePoint(ProxyOnlyResource): @@ -1311,22 +1311,22 @@ def __init__( :paramtype security_profile: ~azure.mgmt.compute.v2023_10_02.models.DiskSecurityProfile """ super().__init__(**kwargs) - self.time_created = None - self.source_resource_id = None - self.os_type = None + self.time_created: Optional[datetime.datetime] = None + self.source_resource_id: Optional[str] = None + self.os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None self.hyper_v_generation = hyper_v_generation self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities - self.family_id = None - self.source_unique_id = None - self.encryption = None + self.family_id: Optional[str] = None + self.source_unique_id: Optional[str] = None + self.encryption: Optional["_models.Encryption"] = None self.supports_hibernation = supports_hibernation self.network_access_policy = network_access_policy self.public_network_access = public_network_access self.disk_access_id = disk_access_id self.completion_percent = completion_percent - self.replication_state = None - self.source_resource_location = None + self.replication_state: Optional[str] = None + self.source_resource_location: Optional[str] = None self.security_profile = security_profile @@ -1436,7 +1436,7 @@ def __init__(self, *, name: Optional[Union[str, "_models.DiskStorageAccountTypes """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class DiskUpdate(_serialization.Model): @@ -1669,7 +1669,7 @@ def __init__( self.bursting_enabled = bursting_enabled self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities - self.property_updates_in_progress = None + self.property_updates_in_progress: Optional["_models.PropertyUpdatesInProgress"] = None self.supports_hibernation = supports_hibernation self.public_network_access = public_network_access self.data_access_auth_mode = data_access_auth_mode @@ -1736,7 +1736,7 @@ class EncryptionSetIdentity(_serialization.Model): :vartype tenant_id: str :ivar user_assigned_identities: The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2023_10_02.models.UserAssignedIdentitiesValue] """ @@ -1770,14 +1770,14 @@ def __init__( :keyword user_assigned_identities: The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2023_10_02.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) self.type = type - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.user_assigned_identities = user_assigned_identities @@ -2169,7 +2169,7 @@ class PrivateEndpoint(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class PrivateEndpointConnection(_serialization.Model): @@ -2228,12 +2228,12 @@ def __init__( ~azure.mgmt.compute.v2023_10_02.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.private_endpoint = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.private_endpoint: Optional["_models.PrivateEndpoint"] = None self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None class PrivateEndpointConnectionListResult(_serialization.Model): @@ -2312,11 +2312,11 @@ def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: :paramtype required_zone_names: list[str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.group_id = None - self.required_members = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.group_id: Optional[str] = None + self.required_members: Optional[List[str]] = None self.required_zone_names = required_zone_names @@ -2534,9 +2534,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s """ super().__init__(**kwargs) self.location = location - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -2560,7 +2560,7 @@ class ShareInfoElement(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.vm_uri = None + self.vm_uri: Optional[str] = None class Snapshot(Resource): @@ -2804,23 +2804,23 @@ def __init__( # pylint: disable=too-many-locals ~azure.mgmt.compute.v2023_10_02.models.DataAccessAuthMode """ super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None + self.managed_by: Optional[str] = None self.sku = sku self.extended_location = extended_location - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.hyper_v_generation = hyper_v_generation self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities self.creation_data = creation_data self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.disk_state = None - self.unique_id = None + self.disk_size_bytes: Optional[int] = None + self.disk_state: Optional[Union[str, "_models.DiskState"]] = None + self.unique_id: Optional[str] = None self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.incremental = incremental - self.incremental_snapshot_family_id = None + self.incremental_snapshot_family_id: Optional[str] = None self.encryption = encryption self.network_access_policy = network_access_policy self.disk_access_id = disk_access_id @@ -2898,7 +2898,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class SnapshotUpdate(_serialization.Model): @@ -3098,7 +3098,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class SupportedCapabilities(_serialization.Model): @@ -3172,8 +3172,8 @@ class SystemData(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.created_at = None - self.last_modified_at = None + self.created_at: Optional[datetime.datetime] = None + self.last_modified_at: Optional[datetime.datetime] = None class UserAssignedIdentitiesValue(_serialization.Model): @@ -3200,5 +3200,5 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/operations/_operations.py index 48c5a01a727f..524e9b681d4d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_10_02/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +56,7 @@ def build_disks_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -92,7 +90,7 @@ def build_disks_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -125,7 +123,7 @@ def build_disks_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -153,7 +151,7 @@ def build_disks_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -181,7 +179,7 @@ def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -236,7 +234,7 @@ def build_disks_grant_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -266,7 +264,7 @@ def build_disks_revoke_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -295,7 +293,7 @@ def build_disk_accesses_create_or_update_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -329,7 +327,7 @@ def build_disk_accesses_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -362,7 +360,7 @@ def build_disk_accesses_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -393,7 +391,7 @@ def build_disk_accesses_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -424,7 +422,7 @@ def build_disk_accesses_list_by_resource_group_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -478,7 +476,7 @@ def build_disk_accesses_get_private_link_resources_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -514,7 +512,7 @@ def build_disk_accesses_update_a_private_endpoint_connection_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -554,7 +552,7 @@ def build_disk_accesses_get_a_private_endpoint_connection_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -592,7 +590,7 @@ def build_disk_accesses_delete_a_private_endpoint_connection_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -626,7 +624,7 @@ def build_disk_accesses_list_private_endpoint_connections_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -658,7 +656,7 @@ def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -692,7 +690,7 @@ def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -725,7 +723,7 @@ def build_disk_encryption_sets_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -756,7 +754,7 @@ def build_disk_encryption_sets_delete_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -787,7 +785,7 @@ def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -841,7 +839,7 @@ def build_disk_encryption_sets_list_associated_resources_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -877,7 +875,7 @@ def build_disk_restore_point_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -916,7 +914,7 @@ def build_disk_restore_point_list_by_restore_point_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -956,7 +954,7 @@ def build_disk_restore_point_grant_access_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -998,7 +996,7 @@ def build_disk_restore_point_revoke_access_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1034,7 +1032,7 @@ def build_snapshots_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1068,7 +1066,7 @@ def build_snapshots_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1101,7 +1099,7 @@ def build_snapshots_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1129,7 +1127,7 @@ def build_snapshots_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1157,7 +1155,7 @@ def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1212,7 +1210,7 @@ def build_snapshots_grant_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1242,7 +1240,7 @@ def build_snapshots_revoke_access_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -1271,10 +1269,10 @@ class DisksOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -2269,10 +2267,10 @@ class DiskAccessesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -3520,10 +3518,10 @@ class DiskEncryptionSetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -4333,10 +4331,10 @@ class DiskRestorePointOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4856,10 +4854,10 @@ class SnapshotsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_compute_management_client.py index 488bc07e9289..47d6d9314d9a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -33,24 +35,23 @@ class ComputeManagementClient: """Compute Client. - :ivar disks: DisksOperations operations - :vartype disks: azure.mgmt.compute.v2024_03_02.operations.DisksOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.v2024_03_02.operations.DiskAccessesOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations :vartype disk_encryption_sets: azure.mgmt.compute.v2024_03_02.operations.DiskEncryptionSetsOperations + :ivar disks: DisksOperations operations + :vartype disks: azure.mgmt.compute.v2024_03_02.operations.DisksOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: azure.mgmt.compute.v2024_03_02.operations.SnapshotsOperations :ivar disk_restore_point: DiskRestorePointOperations operations :vartype disk_restore_point: azure.mgmt.compute.v2024_03_02.operations.DiskRestorePointOperations - :ivar snapshots: SnapshotsOperations operations - :vartype snapshots: azure.mgmt.compute.v2024_03_02.operations.SnapshotsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-03-02". Note that overriding this default value may result in unsupported behavior. @@ -60,15 +61,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -87,23 +90,23 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize, "2024-03-02") self.disk_accesses = DiskAccessesOperations( self._client, self._config, self._serialize, self._deserialize, "2024-03-02" ) self.disk_encryption_sets = DiskEncryptionSetsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-03-02" ) - self.disk_restore_point = DiskRestorePointOperations( + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize, "2024-03-02") + self.snapshots = SnapshotsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-03-02" ) - self.snapshots = SnapshotsOperations( + self.disk_restore_point = DiskRestorePointOperations( self._client, self._config, self._serialize, self._deserialize, "2024-03-02" ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_configuration.py index ec0e17102b9f..ba92a8559fa7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_configuration.py @@ -25,8 +25,7 @@ class ComputeManagementClientConfiguration: # pylint: disable=too-many-instance :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2024-03-02". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_metadata.json index 56f50a2f6fb4..2a0cdeabe248 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -24,7 +24,7 @@ }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true, "method_location": "positional" @@ -39,7 +39,7 @@ }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -105,10 +105,10 @@ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { - "disks": "DisksOperations", "disk_accesses": "DiskAccessesOperations", "disk_encryption_sets": "DiskEncryptionSetsOperations", - "disk_restore_point": "DiskRestorePointOperations", - "snapshots": "SnapshotsOperations" + "disks": "DisksOperations", + "snapshots": "SnapshotsOperations", + "disk_restore_point": "DiskRestorePointOperations" } } diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/_compute_management_client.py index 64416721f0be..d38350b4497a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -33,24 +35,23 @@ class ComputeManagementClient: """Compute Client. - :ivar disks: DisksOperations operations - :vartype disks: azure.mgmt.compute.v2024_03_02.aio.operations.DisksOperations :ivar disk_accesses: DiskAccessesOperations operations :vartype disk_accesses: azure.mgmt.compute.v2024_03_02.aio.operations.DiskAccessesOperations :ivar disk_encryption_sets: DiskEncryptionSetsOperations operations :vartype disk_encryption_sets: azure.mgmt.compute.v2024_03_02.aio.operations.DiskEncryptionSetsOperations + :ivar disks: DisksOperations operations + :vartype disks: azure.mgmt.compute.v2024_03_02.aio.operations.DisksOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: azure.mgmt.compute.v2024_03_02.aio.operations.SnapshotsOperations :ivar disk_restore_point: DiskRestorePointOperations operations :vartype disk_restore_point: azure.mgmt.compute.v2024_03_02.aio.operations.DiskRestorePointOperations - :ivar snapshots: SnapshotsOperations operations - :vartype snapshots: azure.mgmt.compute.v2024_03_02.aio.operations.SnapshotsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-03-02". Note that overriding this default value may result in unsupported behavior. @@ -60,15 +61,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -87,23 +90,25 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize, "2024-03-02") self.disk_accesses = DiskAccessesOperations( self._client, self._config, self._serialize, self._deserialize, "2024-03-02" ) self.disk_encryption_sets = DiskEncryptionSetsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-03-02" ) - self.disk_restore_point = DiskRestorePointOperations( + self.disks = DisksOperations(self._client, self._config, self._serialize, self._deserialize, "2024-03-02") + self.snapshots = SnapshotsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-03-02" ) - self.snapshots = SnapshotsOperations( + self.disk_restore_point = DiskRestorePointOperations( self._client, self._config, self._serialize, self._deserialize, "2024-03-02" ) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/_configuration.py index b42db3bdd5e0..66e5b9ab267b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/_configuration.py @@ -25,8 +25,7 @@ class ComputeManagementClientConfiguration: # pylint: disable=too-many-instance :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2024-03-02". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/operations/__init__.py index 0e0c2d8aaf8d..e14bc6862637 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/operations/__init__.py @@ -12,22 +12,22 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._operations import DisksOperations # type: ignore from ._operations import DiskAccessesOperations # type: ignore from ._operations import DiskEncryptionSetsOperations # type: ignore -from ._operations import DiskRestorePointOperations # type: ignore +from ._operations import DisksOperations # type: ignore from ._operations import SnapshotsOperations # type: ignore +from ._operations import DiskRestorePointOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "DisksOperations", "DiskAccessesOperations", "DiskEncryptionSetsOperations", - "DiskRestorePointOperations", + "DisksOperations", "SnapshotsOperations", + "DiskRestorePointOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/operations/_operations.py index 7bc85f6a15f7..74dc44ba122c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/aio/operations/_operations.py @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_disk_accesses_create_or_update_request, build_disk_accesses_delete_a_private_endpoint_connection_request, @@ -72,37 +74,249 @@ build_snapshots_revoke_access_request, build_snapshots_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class DisksOperations: +class DiskAccessesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.v2024_03_02.aio.ComputeManagementClient`'s - :attr:`disks` attribute. + :attr:`disk_accesses` attribute. """ models = _models def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.DiskAccess"]: + """Lists all the disk access resources under a subscription. + + :return: An iterator like instance of either DiskAccess or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskAccessList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_accesses_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiskAccessList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.DiskAccess"]: + """Lists all the disk access resources under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either DiskAccess or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskAccessList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_accesses_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiskAccessList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _models.DiskAccess: + """Gets information about a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: DiskAccess or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.DiskAccess + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) + + _request = build_disk_accesses_get_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + async def _create_or_update_initial( - self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + disk_access_name: str, + disk_access: Union[_models.DiskAccess, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -122,14 +336,14 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(disk, (IOBase, bytes)): - _content = disk + if isinstance(disk_access, (IOBase, bytes)): + _content = disk_access else: - _json = self._serialize.body(disk, "Disk") + _json = self._serialize.body(disk_access, "DiskAccess") - _request = build_disks_create_or_update_request( + _request = build_disk_accesses_create_or_update_request( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -156,10 +370,15 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -167,75 +386,87 @@ async def _create_or_update_initial( async def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - disk: _models.Disk, + disk_access_name: str, + disk_access: _models.DiskAccess, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Disk]: - """Creates or updates a disk. + ) -> AsyncLROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: ~azure.mgmt.compute.v2024_03_02.models.Disk + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Required. + :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccess :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] - :raises ~azure.core.exceptions.HttpResponseError: + :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - disk: IO[bytes], + disk_access_name: str, + disk_access: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Disk]: - """Creates or updates a disk. + ) -> AsyncLROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: IO[bytes] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Required. + :type disk_access: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Disk]: - """Creates or updates a disk. + self, + resource_group_name: str, + disk_access_name: str, + disk_access: Union[_models.DiskAccess, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Is either a Disk type - or a IO[bytes] type. Required. - :type disk: ~azure.mgmt.compute.v2024_03_02.models.Disk or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Is either a DiskAccess type or a IO[bytes] type. Required. + :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccess or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -243,15 +474,15 @@ async def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, + disk_access_name=disk_access_name, + disk_access=disk_access, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -263,30 +494,36 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Disk", pipeline_response.http_response) + deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Disk].from_continuation_token( + return AsyncLROPoller[_models.DiskAccess].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Disk]( + return AsyncLROPoller[_models.DiskAccess]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) async def _update_initial( - self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + disk_access_name: str, + disk_access: Union[_models.DiskAccessUpdate, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -306,14 +543,14 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(disk, (IOBase, bytes)): - _content = disk + if isinstance(disk_access, (IOBase, bytes)): + _content = disk_access else: - _json = self._serialize.body(disk, "DiskUpdate") + _json = self._serialize.body(disk_access, "DiskAccessUpdate") - _request = build_disks_update_request( + _request = build_disk_accesses_update_request( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -340,10 +577,15 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -351,27 +593,30 @@ async def _update_initial( async def begin_update( self, resource_group_name: str, - disk_name: str, - disk: _models.DiskUpdate, + disk_access_name: str, + disk_access: _models.DiskAccessUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Disk]: - """Updates (patches) a disk. + ) -> AsyncLROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: ~azure.mgmt.compute.v2024_03_02.models.DiskUpdate + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + Required. + :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccessUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -379,47 +624,56 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - disk_name: str, - disk: IO[bytes], + disk_access_name: str, + disk_access: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Disk]: - """Updates (patches) a disk. + ) -> AsyncLROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: IO[bytes] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + Required. + :type disk_access: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_update( - self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Disk]: - """Updates (patches) a disk. + self, + resource_group_name: str, + disk_access_name: str, + disk_access: Union[_models.DiskAccessUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Is either a - DiskUpdate type or a IO[bytes] type. Required. - :type disk: ~azure.mgmt.compute.v2024_03_02.models.DiskUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + Is either a DiskAccessUpdate type or a IO[bytes] type. Required. + :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccessUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -427,15 +681,15 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, + disk_access_name=disk_access_name, + disk_access=disk_access, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -447,42 +701,33 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Disk", pipeline_response.http_response) + deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Disk].from_continuation_token( + return AsyncLROPoller[_models.DiskAccess].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Disk]( + return AsyncLROPoller[_models.DiskAccess]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace_async - async def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _models.Disk: - """Gets information about a disk. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: Disk or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.Disk - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _delete_initial( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -495,11 +740,11 @@ async def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_disks_get_request( + _request = build_disk_accesses_delete_request( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -507,86 +752,51 @@ async def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Disk", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a disk access resource. - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disks_delete_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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=_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a disk. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -598,7 +808,7 @@ async def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -613,7 +823,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -628,20 +840,29 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Disk"]: - """Lists all the disks under a resource group. + def list_private_endpoint_connections( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: + """List information about private endpoint connections under a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either Disk or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.Disk] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -654,8 +875,9 @@ 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_disks_list_by_resource_group_request( + _request = build_disk_accesses_list_private_endpoint_connections_request( resource_group_name=resource_group_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -681,7 +903,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskList", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -704,20 +926,25 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Disk"]: - """Lists all the disks under a subscription. + @distributed_trace_async + async def get_a_private_endpoint_connection( + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets information about a private endpoint connection under a disk access resource. - :return: An iterator like instance of either Disk or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.Disk] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -726,63 +953,47 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Disk"]: } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_disks_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _request = build_disk_accesses_get_a_private_endpoint_connection_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore - async def _grant_access_initial( + async def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, - disk_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -803,14 +1014,15 @@ async def _grant_access_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data + if isinstance(private_endpoint_connection, (IOBase, bytes)): + _content = private_endpoint_connection else: - _json = self._serialize.body(grant_access_data, "GrantAccessData") + _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - _request = build_disks_grant_access_request( + _request = build_disk_accesses_update_a_private_endpoint_connection_request( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -837,95 +1049,121 @@ async def _grant_access_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_grant_access( + async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - disk_name: str, - grant_access_data: _models.GrantAccessData, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: _models.PrivateEndpointConnection, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: + ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_grant_access( + async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - disk_name: str, - grant_access_data: IO[bytes], + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_grant_access( + async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - disk_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Is either a GrantAccessData type or a IO[bytes] type. Required. - :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Is either a PrivateEndpointConnection type or a + IO[bytes] type. Required. + :type private_endpoint_connection: + ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection or IO[bytes] + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -933,15 +1171,16 @@ async def begin_grant_access( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._grant_access_initial( + raw_result = await self._update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, - disk_name=disk_name, - grant_access_data=grant_access_data, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -953,7 +1192,7 @@ async def begin_grant_access( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AccessUri", pipeline_response.http_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -967,18 +1206,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.AccessUri].from_continuation_token( + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.AccessUri]( + return AsyncLROPoller[_models.PrivateEndpointConnection]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _revoke_access_initial( - self, resource_group_name: str, disk_name: str, **kwargs: Any + async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-long + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -994,9 +1233,10 @@ async def _revoke_access_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_disks_revoke_access_request( + _request = build_disk_accesses_delete_a_private_endpoint_connection_request( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -1012,7 +1252,7 @@ async def _revoke_access_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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): @@ -1020,25 +1260,33 @@ async def _revoke_access_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_revoke_access( - self, resource_group_name: str, disk_name: str, **kwargs: Any + async def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Revokes access to a disk. + """Deletes a private endpoint connection under a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1052,9 +1300,10 @@ async def begin_revoke_access( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._revoke_access_initial( + raw_result = await self._delete_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1085,34 +1334,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace_async + async def get_private_link_resources( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourceListResult: + """Gets the private link resources possible under disk access resource. -class DiskAccessesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_03_02.aio.ComputeManagementClient`'s - :attr:`disk_accesses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - async def _create_or_update_initial( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccess, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.PrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1121,193 +1359,281 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk_access, (IOBase, bytes)): - _content = disk_access - else: - _json = self._serialize.body(disk_access, "DiskAccess") + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - _request = build_disk_accesses_create_or_update_request( + _request = build_disk_accesses_get_private_link_resources_request( resource_group_name=resource_group_name, disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: _models.DiskAccess, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskAccess]: - """Creates or updates a disk access resource. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Required. - :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccess - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ +class DiskEncryptionSetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskAccess]: - """Creates or updates a disk access resource. + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_03_02.aio.ComputeManagementClient`'s + :attr:`disk_encryption_sets` attribute. + """ - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Required. - :type disk_access: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.DiskEncryptionSet"]: + """Lists all the disk encryption sets under a subscription. + + :return: An iterator like instance of either DiskEncryptionSet or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccess, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskAccess]: - """Creates or updates a disk access resource. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskEncryptionSetList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_encryption_sets_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DiskEncryptionSet"]: + """Lists all the disk encryption sets under a resource group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Is either a DiskAccess type or a IO[bytes] type. Required. - :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccess or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :return: An iterator like instance of either DiskEncryptionSet or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - disk_access=disk_access, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.DiskEncryptionSetList] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_encryption_sets_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DiskAccess].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[_models.DiskAccess]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> _models.DiskEncryptionSet: + """Gets information about a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: DiskEncryptionSet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + + _request = build_disk_encryption_sets_get_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, ) + _request.url = self._client.format_url(_request.url) - async def _update_initial( + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( self, resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccessUpdate, IO[bytes]], + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSet, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -1328,14 +1654,14 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(disk_access, (IOBase, bytes)): - _content = disk_access + if isinstance(disk_encryption_set, (IOBase, bytes)): + _content = disk_encryption_set else: - _json = self._serialize.body(disk_access, "DiskAccessUpdate") + _json = self._serialize.body(disk_encryption_set, "DiskEncryptionSet") - _request = build_disk_accesses_update_request( + _request = build_disk_encryption_sets_create_or_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -1362,95 +1688,107 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: _models.DiskAccessUpdate, + disk_encryption_set_name: str, + disk_encryption_set: _models.DiskEncryptionSet, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DiskAccess]: - """Updates (patches) a disk access resource. + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccessUpdate + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of + :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: IO[bytes], + disk_encryption_set_name: str, + disk_encryption_set: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DiskAccess]: - """Updates (patches) a disk access resource. + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type disk_access: IO[bytes] + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of + :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccessUpdate, IO[bytes]], + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSet, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.DiskAccess]: - """Updates (patches) a disk access resource. + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. - Is either a DiskAccessUpdate type or a IO[bytes] type. Required. - :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccessUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DiskAccess or the result of + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Is either a DiskEncryptionSet type or a IO[bytes] type. Required. + :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1458,15 +1796,15 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - disk_access=disk_access, + disk_encryption_set_name=disk_encryption_set_name, + disk_encryption_set=disk_encryption_set, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1478,86 +1816,36 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) + deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.DiskAccess].from_continuation_token( + return AsyncLROPoller[_models.DiskEncryptionSet].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.DiskAccess]( + return AsyncLROPoller[_models.DiskEncryptionSet]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace_async - async def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _models.DiskAccess: - """Gets information about a disk access resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: DiskAccess or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.DiskAccess - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) - - _request = build_disk_accesses_get_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any + async def _update_initial( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1567,17 +1855,29 @@ async def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_accesses_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(disk_encryption_set, (IOBase, bytes)): + _content = disk_encryption_set + else: + _json = self._serialize.body(disk_encryption_set, "DiskEncryptionSetUpdate") + + _request = build_disk_encryption_sets_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -1591,7 +1891,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -1599,59 +1899,263 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a disk access resource. + @overload + async def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: _models.DiskEncryptionSetUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSetUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: + @overload + async def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Is either a DiskEncryptionSetUpdate type or a IO[bytes] type. + Required. + :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSetUpdate or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + disk_encryption_set=disk_encryption_set, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DiskEncryptionSet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DiskEncryptionSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disk_encryption_sets_delete_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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=_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling if cont_token: return AsyncLROPoller[None].from_continuation_token( @@ -1663,21 +2167,27 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.DiskAccess"]: - """Lists all the disk access resources under a resource group. + def list_associated_resources( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> AsyncIterable[str]: + """Lists all resources that are encrypted with this disk encryption set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either DiskAccess or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: An iterator like instance of either str or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[str] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskAccessList] = kwargs.pop("cls", None) + cls: ClsType[_models.ResourceUriList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1690,8 +2200,9 @@ 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_disk_accesses_list_by_resource_group_request( + _request = build_disk_encryption_sets_list_associated_resources_request( resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -1717,7 +2228,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskAccessList", pipeline_response) + deserialized = self._deserialize("ResourceUriList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1740,20 +2251,40 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + +class DisksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_03_02.aio.ComputeManagementClient`'s + :attr:`disks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.DiskAccess"]: - """Lists all the disk access resources under a subscription. + def list(self, **kwargs: Any) -> AsyncIterable["_models.Disk"]: + """Lists all the disks under a subscription. - :return: An iterator like instance of either DiskAccess or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :return: An iterator like instance of either Disk or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskAccessList] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1766,7 +2297,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DiskAccess"]: def prepare_request(next_link=None): if not next_link: - _request = build_disk_accesses_list_request( + _request = build_disks_list_request( subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -1792,7 +2323,85 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskAccessList", pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Disk"]: + """Lists all the disks under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either Disk or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.Disk] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1816,19 +2425,18 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get_private_link_resources( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> _models.PrivateLinkResourceListResult: - """Gets the private link resources possible under disk access resource. + async def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _models.Disk: + """Gets information about a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.PrivateLinkResourceListResult + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: Disk or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.Disk :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1843,11 +2451,11 @@ async def get_private_link_resources( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) - _request = build_disk_accesses_get_private_link_resources_request( + _request = build_disks_get_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -1866,20 +2474,15 @@ async def get_private_link_resources( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) + deserialized = self._deserialize("Disk", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any + async def _create_or_update_initial( + self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1899,15 +2502,14 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name content_type = content_type or "application/json" _json = None _content = None - if isinstance(private_endpoint_connection, (IOBase, bytes)): - _content = private_endpoint_connection + if isinstance(disk, (IOBase, bytes)): + _content = disk else: - _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") + _json = self._serialize.body(disk, "Disk") - _request = build_disk_accesses_update_a_private_endpoint_connection_request( + _request = build_disks_create_or_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -1934,113 +2536,94 @@ async def _update_a_private_endpoint_connection_initial( # pylint: disable=name map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, + disk_name: str, + disk: _models.Disk, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. + ) -> AsyncLROPoller[_models.Disk]: + """Creates or updates a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: - ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: ~azure.mgmt.compute.v2024_03_02.models.Disk :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] + :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long + async def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: IO[bytes], + disk_name: str, + disk: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. + ) -> AsyncLROPoller[_models.Disk]: + """Creates or updates a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: IO[bytes] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] + :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. + async def begin_create_or_update( + self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.Disk]: + """Creates or updates a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Is either a PrivateEndpointConnection type or a - IO[bytes] type. Required. - :type private_endpoint_connection: - ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Is either a Disk type + or a IO[bytes] type. Required. + :type disk: ~azure.mgmt.compute.v2024_03_02.models.Disk or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2048,16 +2631,15 @@ async def begin_update_a_private_endpoint_connection( # pylint: disable=name-to api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_a_private_endpoint_connection_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - private_endpoint_connection=private_endpoint_connection, + disk_name=disk_name, + disk=disk, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -2069,91 +2651,32 @@ async def begin_update_a_private_endpoint_connection( # pylint: disable=name-to kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + deserialized = self._deserialize("Disk", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( + return AsyncLROPoller[_models.Disk].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.PrivateEndpointConnection]( + return AsyncLROPoller[_models.Disk]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace_async - async def get_a_private_endpoint_connection( - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets information about a private endpoint connection under a disk access resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_disk_accesses_get_a_private_endpoint_connection_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-long - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + async def _update_initial( + self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2163,18 +2686,29 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_accesses_delete_a_private_endpoint_connection_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(disk, (IOBase, bytes)): + _content = disk + else: + _json = self._serialize.body(disk, "DiskUpdate") + + _request = build_disks_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -2188,7 +2722,7 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -2196,186 +2730,146 @@ async def _delete_a_private_endpoint_connection_initial( # pylint: disable=name map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a private endpoint connection under a disk access resource. + @overload + async def begin_update( + self, + resource_group_name: str, + disk_name: str, + disk: _models.DiskUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Disk]: + """Updates (patches) a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: ~azure.mgmt.compute.v2024_03_02.models.DiskUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_a_private_endpoint_connection_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + @overload + async def begin_update( + self, + resource_group_name: str, + disk_name: str, + disk: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Disk]: + """Updates (patches) a disk. - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :raises ~azure.core.exceptions.HttpResponseError: + """ - @distributed_trace - def list_private_endpoint_connections( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnection"]: - """List information about private endpoint connections under a disk access resource. + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.Disk]: + """Updates (patches) a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Is either a + DiskUpdate type or a IO[bytes] type. Required. + :type disk: ~azure.mgmt.compute.v2024_03_02.models.DiskUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_accesses_list_private_endpoint_connections_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class DiskEncryptionSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_03_02.aio.ComputeManagementClient`'s - :attr:`disk_encryption_sets` attribute. - """ + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + disk=disk, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - models = _models + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Disk", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Disk].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Disk]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _create_or_update_initial( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSet, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: + async def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2384,29 +2878,17 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk_encryption_set, (IOBase, bytes)): - _content = disk_encryption_set - else: - _json = self._serialize.body(disk_encryption_set, "DiskEncryptionSet") - - _request = build_disk_encryption_sets_create_or_update_request( + _request = build_disks_delete_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -2420,7 +2902,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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): @@ -2428,117 +2910,46 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: _models.DiskEncryptionSet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskEncryptionSet]: - """Creates or updates a disk encryption set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskEncryptionSet]: - """Creates or updates a disk encryption set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSet, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DiskEncryptionSet]: - """Creates or updates a disk encryption set. + async def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Is either a DiskEncryptionSet type or a IO[bytes] type. Required. - :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - disk_encryption_set=disk_encryption_set, + disk_name=disk_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -2547,34 +2958,32 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.DiskEncryptionSet].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.DiskEncryptionSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _update_initial( + async def _grant_access_initial( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, IO[bytes]], + disk_name: str, + grant_access_data: Union[_models.GrantAccessData, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -2595,14 +3004,14 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(disk_encryption_set, (IOBase, bytes)): - _content = disk_encryption_set + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data else: - _json = self._serialize.body(disk_encryption_set, "DiskEncryptionSetUpdate") + _json = self._serialize.body(grant_access_data, "GrantAccessData") - _request = build_disk_encryption_sets_update_request( + _request = build_disks_grant_access_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -2629,100 +3038,103 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_update( + async def begin_grant_access( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: _models.DiskEncryptionSetUpdate, + disk_name: str, + grant_access_data: _models.GrantAccessData, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DiskEncryptionSet]: - """Updates (patches) a disk encryption set. + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSetUpdate + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of + :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_grant_access( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: IO[bytes], + disk_name: str, + grant_access_data: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.DiskEncryptionSet]: - """Updates (patches) a disk encryption set. + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: IO[bytes] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of + :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_grant_access( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, IO[bytes]], + disk_name: str, + grant_access_data: Union[_models.GrantAccessData, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.DiskEncryptionSet]: - """Updates (patches) a disk encryption set. + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a disk. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Is either a DiskEncryptionSetUpdate type or a IO[bytes] type. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSetUpdate or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either DiskEncryptionSet or the result of + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Is either a GrantAccessData type or a IO[bytes] type. Required. + :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2730,15 +3142,15 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._grant_access_initial( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - disk_encryption_set=disk_encryption_set, + disk_name=disk_name, + grant_access_data=grant_access_data, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -2750,88 +3162,32 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) + deserialized = self._deserialize("AccessUri", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.DiskEncryptionSet].from_continuation_token( + return AsyncLROPoller[_models.AccessUri].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.DiskEncryptionSet]( + return AsyncLROPoller[_models.AccessUri]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace_async - async def get( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> _models.DiskEncryptionSet: - """Gets information about a disk encryption set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) - - _request = build_disk_encryption_sets_get_request( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + async def _revoke_access_initial( + self, resource_group_name: str, disk_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2847,9 +3203,9 @@ async def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_encryption_sets_delete_request( + _request = build_disks_revoke_access_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -2865,7 +3221,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -2873,25 +3229,31 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + async def begin_revoke_access( + self, resource_group_name: str, disk_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes a disk encryption set. + """Revokes access to a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2905,9 +3267,9 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + disk_name=disk_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -2922,7 +3284,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -2936,100 +3300,41 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DiskEncryptionSet"]: - """Lists all the disk encryption sets under a resource group. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :return: An iterator like instance of either DiskEncryptionSet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskEncryptionSetList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_encryption_sets_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_03_02.aio.ComputeManagementClient`'s + :attr:`snapshots` attribute. + """ - return pipeline_response + models = _models - return AsyncItemPaged(get_next, extract_data) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.DiskEncryptionSet"]: - """Lists all the disk encryption sets under a subscription. + def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: + """Lists snapshots under a subscription. - :return: An iterator like instance of either DiskEncryptionSet or the result of cls(response) + :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskEncryptionSetList] = kwargs.pop("cls", None) + cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3042,7 +3347,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DiskEncryptionSet"]: def prepare_request(next_link=None): if not next_link: - _request = build_disk_encryption_sets_list_request( + _request = build_snapshots_list_request( subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -3068,7 +3373,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3092,26 +3397,22 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_associated_resources( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> AsyncIterable[str]: - """Lists all resources that are encrypted with this disk encryption set. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: + """Lists snapshots under a resource group. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: An iterator like instance of either str or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[str] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.ResourceUriList] = kwargs.pop("cls", None) + cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3124,9 +3425,8 @@ def list_associated_resources( def prepare_request(next_link=None): if not next_link: - _request = build_disk_encryption_sets_list_associated_resources_request( + _request = build_snapshots_list_by_resource_group_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -3152,7 +3452,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceUriList", pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -3175,50 +3475,19 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class DiskRestorePointOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_03_02.aio.ComputeManagementClient`'s - :attr:`disk_restore_point` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - @distributed_trace_async - async def get( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - **kwargs: Any - ) -> _models.DiskRestorePoint: - """Get disk restorePoint resource. + async def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: + """Gets information about a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the disk restore point created. Required. - :type disk_restore_point_name: str - :return: DiskRestorePoint or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.DiskRestorePoint + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3233,13 +3502,11 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskRestorePoint] = kwargs.pop("cls", None) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - _request = build_disk_restore_point_get_request( + _request = build_snapshots_get_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -3258,109 +3525,15 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiskRestorePoint", pipeline_response.http_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_by_restore_point( - self, resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DiskRestorePoint"]: - """Lists diskRestorePoints under a vmRestorePoint. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :return: An iterator like instance of either DiskRestorePoint or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskRestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskRestorePointList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_restore_point_list_by_restore_point_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DiskRestorePointList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _grant_access_initial( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any + async def _create_or_update_initial( + self, resource_group_name: str, snapshot_name: str, snapshot: Union[_models.Snapshot, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3380,16 +3553,14 @@ async def _grant_access_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data + if isinstance(snapshot, (IOBase, bytes)): + _content = snapshot else: - _json = self._serialize.body(grant_access_data, "GrantAccessData") + _json = self._serialize.body(snapshot, "Snapshot") - _request = build_disk_restore_point_grant_access_request( + _request = build_snapshots_create_or_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -3416,113 +3587,97 @@ async def _grant_access_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_grant_access( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: _models.GrantAccessData, + snapshot_name: str, + snapshot: _models.Snapshot, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + ) -> AsyncLROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the disk restore point created. Required. - :type disk_restore_point_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.Snapshot :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of + :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_grant_access( + async def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: IO[bytes], + snapshot_name: str, + snapshot: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + ) -> AsyncLROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the disk restore point created. Required. - :type disk_restore_point_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: IO[bytes] + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of + :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_grant_access( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, snapshot_name: str, snapshot: Union[_models.Snapshot, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the disk restore point created. Required. - :type disk_restore_point_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Is either a GrantAccessData type or a IO[bytes] type. Required. - :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AccessUri or the result of + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Is either a + Snapshot type or a IO[bytes] type. Required. + :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.Snapshot or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3530,17 +3685,15 @@ async def begin_grant_access( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._grant_access_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - grant_access_data=grant_access_data, + snapshot_name=snapshot_name, + snapshot=snapshot, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3552,7 +3705,7 @@ async def begin_grant_access( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AccessUri", pipeline_response.http_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3566,22 +3719,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.AccessUri].from_continuation_token( + return AsyncLROPoller[_models.Snapshot].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.AccessUri]( + return AsyncLROPoller[_models.Snapshot]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _revoke_access_initial( + async def _update_initial( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, + snapshot_name: str, + snapshot: Union[_models.SnapshotUpdate, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -3592,19 +3744,29 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_restore_point_revoke_access_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(snapshot, (IOBase, bytes)): + _content = snapshot + else: + _json = self._serialize.body(snapshot, "SnapshotUpdate") + + _request = build_snapshots_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -3626,53 +3788,121 @@ async def _revoke_access_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + async def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: _models.SnapshotUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.SnapshotUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either Snapshot or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type snapshot: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either Snapshot or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_revoke_access( + async def begin_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, + snapshot_name: str, + snapshot: Union[_models.SnapshotUpdate, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Revokes access to a diskRestorePoint. + ) -> AsyncLROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the disk restore point created. Required. - :type disk_restore_point_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Is + either a SnapshotUpdate type or a IO[bytes] type. Required. + :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.SnapshotUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Snapshot or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._revoke_access_initial( + raw_result = await self._update_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, + snapshot=snapshot, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -3681,9 +3911,11 @@ async def begin_revoke_access( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: polling_method: AsyncPollingMethod = cast( @@ -3694,37 +3926,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.Snapshot].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - -class SnapshotsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_03_02.aio.ComputeManagementClient`'s - :attr:`snapshots` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + return AsyncLROPoller[_models.Snapshot]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _create_or_update_initial( - self, resource_group_name: str, snapshot_name: str, snapshot: Union[_models.Snapshot, IO[bytes]], **kwargs: Any + async def _delete_initial( + self, resource_group_name: str, snapshot_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3734,29 +3947,17 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(snapshot, (IOBase, bytes)): - _content = snapshot - else: - _json = self._serialize.body(snapshot, "Snapshot") - - _request = build_snapshots_create_or_update_request( + _request = build_snapshots_delete_request( resource_group_name=resource_group_name, snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -3770,115 +3971,54 @@ async def _create_or_update_initial( 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: _models.Snapshot, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Creates or updates a snapshot. + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.Snapshot - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Creates or updates a snapshot. + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async - async def begin_create_or_update( - self, resource_group_name: str, snapshot_name: str, snapshot: Union[_models.Snapshot, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Creates or updates a snapshot. + async def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param snapshot_name: The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Is either a - Snapshot type or a IO[bytes] type. Required. - :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.Snapshot or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, - snapshot=snapshot, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -3887,34 +4027,32 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Snapshot].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Snapshot]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _update_initial( + async def _grant_access_initial( self, resource_group_name: str, snapshot_name: str, - snapshot: Union[_models.SnapshotUpdate, IO[bytes]], + grant_access_data: Union[_models.GrantAccessData, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -3935,12 +4073,12 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(snapshot, (IOBase, bytes)): - _content = snapshot + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data else: - _json = self._serialize.body(snapshot, "SnapshotUpdate") + _json = self._serialize.body(grant_access_data, "GrantAccessData") - _request = build_snapshots_update_request( + _request = build_snapshots_grant_access_request( resource_group_name=resource_group_name, snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, @@ -3969,95 +4107,103 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_update( + async def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - snapshot: _models.SnapshotUpdate, + grant_access_data: _models.GrantAccessData, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Updates (patches) a snapshot. + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param snapshot_name: The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.SnapshotUpdate + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of + :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - snapshot: IO[bytes], + grant_access_data: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Updates (patches) a snapshot. + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param snapshot_name: The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: IO[bytes] + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of + :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - snapshot: Union[_models.SnapshotUpdate, IO[bytes]], + grant_access_data: Union[_models.GrantAccessData, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Snapshot]: - """Updates (patches) a snapshot. + ) -> AsyncLROPoller[_models.AccessUri]: + """Grants access to a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param snapshot_name: The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Is - either a SnapshotUpdate type or a IO[bytes] type. Required. - :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.SnapshotUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Is either a GrantAccessData type or a IO[bytes] type. Required. + :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4065,15 +4211,15 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._grant_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, - snapshot=snapshot, + grant_access_data=grant_access_data, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -4085,85 +4231,31 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) + deserialized = self._deserialize("AccessUri", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Snapshot].from_continuation_token( + return AsyncLROPoller[_models.AccessUri].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Snapshot]( + return AsyncLROPoller[_models.AccessUri]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace_async - async def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: - """Gets information about a snapshot. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: Snapshot or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.Snapshot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - - _request = build_snapshots_get_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( + async def _revoke_access_initial( self, resource_group_name: str, snapshot_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -4180,7 +4272,7 @@ async def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_snapshots_delete_request( + _request = build_snapshots_revoke_access_request( resource_group_name=resource_group_name, snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, @@ -4198,7 +4290,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -4206,18 +4298,26 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a snapshot. + async def begin_revoke_access( + self, resource_group_name: str, snapshot_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Revokes access to a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param snapshot_name: The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. @@ -4236,7 +4336,7 @@ async def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwa lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, api_version=api_version, @@ -4253,7 +4353,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -4267,22 +4369,52 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + +class DiskRestorePointOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_03_02.aio.ComputeManagementClient`'s + :attr:`disk_restore_point` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: - """Lists snapshots under a resource group. + def list_by_restore_point( + self, resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DiskRestorePoint"]: + """Lists diskRestorePoints under a vmRestorePoint. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either Snapshot or the result of cls(response) + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :return: An iterator like instance of either DiskRestorePoint or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskRestorePoint] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskRestorePointList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4295,8 +4427,10 @@ 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_snapshots_list_by_resource_group_request( + _request = build_disk_restore_point_list_by_restore_point_request( resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -4322,7 +4456,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("SnapshotList", pipeline_response) + deserialized = self._deserialize("DiskRestorePointList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4345,21 +4479,32 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: - """Lists snapshots under a subscription. + @distributed_trace_async + async def get( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> _models.DiskRestorePoint: + """Get disk restorePoint resource. - :return: An iterator like instance of either Snapshot or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :return: DiskRestorePoint or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.DiskRestorePoint :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4368,62 +4513,48 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Snapshot"]: } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_snapshots_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskRestorePoint] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _request = build_disk_restore_point_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - async def extract_data(pipeline_response): - deserialized = self._deserialize("SnapshotList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("DiskRestorePoint", pipeline_response.http_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore async def _grant_access_initial( self, resource_group_name: str, - snapshot_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, grant_access_data: Union[_models.GrantAccessData, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -4450,9 +4581,11 @@ async def _grant_access_initial( else: _json = self._serialize.body(grant_access_data, "GrantAccessData") - _request = build_snapshots_grant_access_request( + _request = build_disk_restore_point_grant_access_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -4479,10 +4612,15 @@ async def _grant_access_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -4490,21 +4628,28 @@ async def _grant_access_initial( async def begin_grant_access( self, resource_group_name: str, - snapshot_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, grant_access_data: _models.GrantAccessData, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a snapshot. + """Grants access to a diskRestorePoint. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access operation. Required. :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -4520,21 +4665,28 @@ async def begin_grant_access( async def begin_grant_access( self, resource_group_name: str, - snapshot_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, grant_access_data: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a snapshot. + """Grants access to a diskRestorePoint. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access operation. Required. :type grant_access_data: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -4550,19 +4702,26 @@ async def begin_grant_access( async def begin_grant_access( self, resource_group_name: str, - snapshot_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, grant_access_data: Union[_models.GrantAccessData, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.AccessUri]: - """Grants access to a snapshot. + """Grants access to a diskRestorePoint. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access operation. Is either a GrantAccessData type or a IO[bytes] type. Required. :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData or IO[bytes] :return: An instance of AsyncLROPoller that returns either AccessUri or the result of @@ -4582,7 +4741,9 @@ async def begin_grant_access( if cont_token is None: raw_result = await self._grant_access_initial( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, api_version=api_version, content_type=content_type, @@ -4620,7 +4781,12 @@ def get_long_running_output(pipeline_response): ) async def _revoke_access_initial( - self, resource_group_name: str, snapshot_name: str, **kwargs: Any + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4636,9 +4802,11 @@ async def _revoke_access_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_snapshots_revoke_access_request( + _request = build_disk_restore_point_revoke_access_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -4662,25 +4830,40 @@ async def _revoke_access_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async async def begin_revoke_access( - self, resource_group_name: str, snapshot_name: str, **kwargs: Any + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any ) -> AsyncLROPoller[None]: - """Revokes access to a snapshot. + """Revokes access to a diskRestorePoint. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -4696,7 +4879,9 @@ async def begin_revoke_access( if cont_token is None: raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/models/__init__.py index 087321a1aa15..6cf5ad18d4db 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/models/__init__.py @@ -27,6 +27,7 @@ DiskEncryptionSetList, DiskEncryptionSetUpdate, DiskList, + DiskPurchasePlan, DiskRestorePoint, DiskRestorePointList, DiskSecurityProfile, @@ -50,9 +51,9 @@ PrivateLinkResourceListResult, PrivateLinkServiceConnectionState, PropertyUpdatesInProgress, - ProxyOnlyResource, - PurchasePlan, + ProxyResource, Resource, + ResourceAutoGenerated, ResourceUriList, ResourceWithOptionalLocation, ShareInfoElement, @@ -65,13 +66,17 @@ SubResourceReadOnly, SupportedCapabilities, SystemData, + SystemDataAutoGenerated, + TrackedResource, UserAssignedIdentitiesValue, + UserAssignedIdentitiesValueAutoGenerated, ) from ._compute_management_client_enums import ( # type: ignore AccessLevel, Architecture, CopyCompletionErrorReason, + CreatedByType, DataAccessAuthMode, DiskCreateOption, DiskEncryptionSetIdentityType, @@ -109,6 +114,7 @@ "DiskEncryptionSetList", "DiskEncryptionSetUpdate", "DiskList", + "DiskPurchasePlan", "DiskRestorePoint", "DiskRestorePointList", "DiskSecurityProfile", @@ -132,9 +138,9 @@ "PrivateLinkResourceListResult", "PrivateLinkServiceConnectionState", "PropertyUpdatesInProgress", - "ProxyOnlyResource", - "PurchasePlan", + "ProxyResource", "Resource", + "ResourceAutoGenerated", "ResourceUriList", "ResourceWithOptionalLocation", "ShareInfoElement", @@ -147,10 +153,14 @@ "SubResourceReadOnly", "SupportedCapabilities", "SystemData", + "SystemDataAutoGenerated", + "TrackedResource", "UserAssignedIdentitiesValue", + "UserAssignedIdentitiesValueAutoGenerated", "AccessLevel", "Architecture", "CopyCompletionErrorReason", + "CreatedByType", "DataAccessAuthMode", "DiskCreateOption", "DiskEncryptionSetIdentityType", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/models/_compute_management_client_enums.py index 4a70d0b63b49..d2939b5451cc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/models/_compute_management_client_enums.py @@ -11,7 +11,7 @@ class AccessLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AccessLevel.""" + """The Access Level, accepted values include None, Read, Write.""" NONE = "None" READ = "Read" @@ -35,6 +35,15 @@ class CopyCompletionErrorReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): created via CopyStart operation was in progress.""" +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + class DataAccessAuthMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Additional authentication requirements when exporting or uploading to a disk or snapshot.""" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/models/_models_py3.py index 22fde77e943d..0d24d42ed581 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization @@ -39,8 +40,8 @@ class AccessUri(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.access_sas = None - self.security_data_access_sas = None + self.access_sas: Optional[str] = None + self.security_data_access_sas: Optional[str] = None class ApiError(_serialization.Model): @@ -311,7 +312,7 @@ def __init__( self.gallery_image_reference = gallery_image_reference self.source_uri = source_uri self.source_resource_id = source_resource_id - self.source_unique_id = None + self.source_unique_id: Optional[str] = None self.upload_size_bytes = upload_size_bytes self.logical_sector_size = logical_sector_size self.security_data_uri = security_data_uri @@ -321,28 +322,76 @@ def __init__( class Resource(_serialization.Model): - """The Resource model definition. + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_03_02.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_03_02.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, } @@ -350,42 +399,45 @@ class Resource(_serialization.Model): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location self.tags = tags + self.location = location -class Disk(Resource): +class Disk(TrackedResource): """Disk 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_03_02.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar managed_by: A relative URI containing the ID of the VM that has the disk attached. :vartype managed_by: str :ivar managed_by_extended: List of relative URIs containing the IDs of the VMs that have the @@ -410,7 +462,7 @@ class Disk(Resource): :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}. - :vartype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.PurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.DiskPurchasePlan :ivar supported_capabilities: List of supported capabilities for the image from which the OS disk was created. :vartype supported_capabilities: ~azure.mgmt.compute.v2024_03_02.models.SupportedCapabilities @@ -507,6 +559,7 @@ class Disk(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "managed_by": {"readonly": True}, "managed_by_extended": {"readonly": True}, @@ -525,8 +578,9 @@ class Disk(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "managed_by": {"key": "managedBy", "type": "str"}, "managed_by_extended": {"key": "managedByExtended", "type": "[str]"}, "sku": {"key": "sku", "type": "DiskSku"}, @@ -535,7 +589,7 @@ class Disk(Resource): "time_created": {"key": "properties.timeCreated", "type": "iso-8601"}, "os_type": {"key": "properties.osType", "type": "str"}, "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "purchase_plan": {"key": "properties.purchasePlan", "type": "PurchasePlan"}, + "purchase_plan": {"key": "properties.purchasePlan", "type": "DiskPurchasePlan"}, "supported_capabilities": {"key": "properties.supportedCapabilities", "type": "SupportedCapabilities"}, "creation_data": {"key": "properties.creationData", "type": "CreationData"}, "disk_size_gb": {"key": "properties.diskSizeGB", "type": "int"}, @@ -582,7 +636,7 @@ def __init__( # pylint: disable=too-many-locals extended_location: Optional["_models.ExtendedLocation"] = None, os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - purchase_plan: Optional["_models.PurchasePlan"] = None, + purchase_plan: Optional["_models.DiskPurchasePlan"] = None, supported_capabilities: Optional["_models.SupportedCapabilities"] = None, creation_data: Optional["_models.CreationData"] = None, disk_size_gb: Optional[int] = None, @@ -606,10 +660,10 @@ def __init__( # pylint: disable=too-many-locals **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword sku: The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. :paramtype sku: ~azure.mgmt.compute.v2024_03_02.models.DiskSku @@ -626,7 +680,7 @@ def __init__( # pylint: disable=too-many-locals :keyword purchase_plan: Purchase plan information for the the image from which the OS disk was created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}. - :paramtype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.PurchasePlan + :paramtype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.DiskPurchasePlan :keyword supported_capabilities: List of supported capabilities for the image from which the OS disk was created. :paramtype supported_capabilities: ~azure.mgmt.compute.v2024_03_02.models.SupportedCapabilities @@ -698,63 +752,68 @@ def __init__( # pylint: disable=too-many-locals the virtual machine. :paramtype optimized_for_frequent_attach: bool """ - super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None - self.managed_by_extended = None + super().__init__(tags=tags, location=location, **kwargs) + self.managed_by: Optional[str] = None + self.managed_by_extended: Optional[List[str]] = None self.sku = sku self.zones = zones self.extended_location = extended_location - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.hyper_v_generation = hyper_v_generation self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities self.creation_data = creation_data self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.unique_id = None + self.disk_size_bytes: Optional[int] = None + self.unique_id: Optional[str] = None self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.disk_iops_read_write = disk_iops_read_write self.disk_m_bps_read_write = disk_m_bps_read_write self.disk_iops_read_only = disk_iops_read_only self.disk_m_bps_read_only = disk_m_bps_read_only - self.disk_state = None + self.disk_state: Optional[Union[str, "_models.DiskState"]] = None self.encryption = encryption self.max_shares = max_shares - self.share_info = None + self.share_info: Optional[List["_models.ShareInfoElement"]] = None self.network_access_policy = network_access_policy self.disk_access_id = disk_access_id - self.bursting_enabled_time = None + self.bursting_enabled_time: Optional[datetime.datetime] = None self.tier = tier self.bursting_enabled = bursting_enabled - self.property_updates_in_progress = None + self.property_updates_in_progress: Optional["_models.PropertyUpdatesInProgress"] = None self.supports_hibernation = supports_hibernation self.security_profile = security_profile self.completion_percent = completion_percent self.public_network_access = public_network_access self.data_access_auth_mode = data_access_auth_mode self.optimized_for_frequent_attach = optimized_for_frequent_attach - self.last_ownership_update_time = None + self.last_ownership_update_time: Optional[datetime.datetime] = None -class DiskAccess(Resource): +class DiskAccess(TrackedResource): """disk access 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_03_02.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar extended_location: The extended location where the disk access will be created. Extended location cannot be changed. :vartype extended_location: ~azure.mgmt.compute.v2024_03_02.models.ExtendedLocation @@ -772,6 +831,7 @@ class DiskAccess(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "private_endpoint_connections": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -782,8 +842,9 @@ class DiskAccess(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "private_endpoint_connections": { "key": "properties.privateEndpointConnections", @@ -802,19 +863,19 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword extended_location: The extended location where the disk access will be created. Extended location cannot be changed. :paramtype extended_location: ~azure.mgmt.compute.v2024_03_02.models.ExtendedLocation """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.extended_location = extended_location - self.private_endpoint_connections = None - self.provisioning_state = None - self.time_created = None + self.private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None + self.provisioning_state: Optional[str] = None + self.time_created: Optional[datetime.datetime] = None class DiskAccessList(_serialization.Model): @@ -822,10 +883,9 @@ class DiskAccessList(_serialization.Model): All required parameters must be populated in order to send to server. - :ivar value: A list of disk access resources. Required. + :ivar value: The DiskAccess items on this page. Required. :vartype value: list[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] - :ivar next_link: The uri to fetch the next page of disk access resources. Call ListNext() with - this to fetch the next page of disk access resources. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -840,10 +900,9 @@ class DiskAccessList(_serialization.Model): def __init__(self, *, value: List["_models.DiskAccess"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: A list of disk access resources. Required. + :keyword value: The DiskAccess items on this page. Required. :paramtype value: list[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] - :keyword next_link: The uri to fetch the next page of disk access resources. Call ListNext() - with this to fetch the next page of disk access resources. + :keyword next_link: The link to the next page of items. :paramtype next_link: str """ super().__init__(**kwargs) @@ -871,23 +930,28 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N self.tags = tags -class DiskEncryptionSet(Resource): +class DiskEncryptionSet(TrackedResource): """disk encryption set 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_03_02.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar identity: The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. :vartype identity: ~azure.mgmt.compute.v2024_03_02.models.EncryptionSetIdentity @@ -922,6 +986,7 @@ class DiskEncryptionSet(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "previous_keys": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -933,8 +998,9 @@ class DiskEncryptionSet(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "identity": {"key": "identity", "type": "EncryptionSetIdentity"}, "encryption_type": {"key": "properties.encryptionType", "type": "str"}, "active_key": {"key": "properties.activeKey", "type": "KeyForDiskEncryptionSet"}, @@ -962,10 +1028,10 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword identity: The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. :paramtype identity: ~azure.mgmt.compute.v2024_03_02.models.EncryptionSetIdentity @@ -982,15 +1048,15 @@ def __init__( different tenant. Setting the value to 'None' will clear the property. :paramtype federated_client_id: str """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.identity = identity self.encryption_type = encryption_type self.active_key = active_key - self.previous_keys = None - self.provisioning_state = None + self.previous_keys: Optional[List["_models.KeyForDiskEncryptionSet"]] = None + self.provisioning_state: Optional[str] = None self.rotation_to_latest_key_version_enabled = rotation_to_latest_key_version_enabled - self.last_key_rotation_timestamp = None - self.auto_key_rotation_error = None + self.last_key_rotation_timestamp: Optional[datetime.datetime] = None + self.auto_key_rotation_error: Optional["_models.ApiError"] = None self.federated_client_id = federated_client_id @@ -999,10 +1065,9 @@ class DiskEncryptionSetList(_serialization.Model): All required parameters must be populated in order to send to server. - :ivar value: A list of disk encryption sets. Required. + :ivar value: The DiskEncryptionSet items on this page. Required. :vartype value: list[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] - :ivar next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() with - this to fetch the next page of disk encryption sets. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -1019,10 +1084,9 @@ def __init__( self, *, value: List["_models.DiskEncryptionSet"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: A list of disk encryption sets. Required. + :keyword value: The DiskEncryptionSet items on this page. Required. :paramtype value: list[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] - :keyword next_link: The uri to fetch the next page of disk encryption sets. Call ListNext() - with this to fetch the next page of disk encryption sets. + :keyword next_link: The link to the next page of items. :paramtype next_link: str """ super().__init__(**kwargs) @@ -1110,10 +1174,9 @@ class DiskList(_serialization.Model): All required parameters must be populated in order to send to server. - :ivar value: A list of disks. Required. + :ivar value: The Disk items on this page. Required. :vartype value: list[~azure.mgmt.compute.v2024_03_02.models.Disk] - :ivar next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -1128,10 +1191,9 @@ class DiskList(_serialization.Model): def __init__(self, *, value: List["_models.Disk"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: A list of disks. Required. + :keyword value: The Disk items on this page. Required. :paramtype value: list[~azure.mgmt.compute.v2024_03_02.models.Disk] - :keyword next_link: The uri to fetch the next page of disks. Call ListNext() with this to fetch - the next page of disks. + :keyword next_link: The link to the next page of items. :paramtype next_link: str """ super().__init__(**kwargs) @@ -1139,50 +1201,92 @@ def __init__(self, *, value: List["_models.Disk"], next_link: Optional[str] = No self.next_link = next_link -class ProxyOnlyResource(_serialization.Model): - """The ProxyOnly Resource model definition. +class DiskPurchasePlan(_serialization.Model): + """Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. - 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 server. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. + :ivar name: The plan ID. Required. :vartype name: str - :ivar type: Resource type. - :vartype type: str + :ivar publisher: The publisher ID. Required. + :vartype publisher: str + :ivar product: Specifies the product of the image from the marketplace. This is the same value + as Offer under the imageReference element. Required. + :vartype product: str + :ivar promotion_code: The Offer Promotion Code. + :vartype promotion_code: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "name": {"required": True}, + "publisher": {"required": True}, + "product": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "product": {"key": "product", "type": "str"}, + "promotion_code": {"key": "promotionCode", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, name: str, publisher: str, product: str, promotion_code: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword name: The plan ID. Required. + :paramtype name: str + :keyword publisher: The publisher ID. Required. + :paramtype publisher: str + :keyword product: Specifies the product of the image from the marketplace. This is the same + value as Offer under the imageReference element. Required. + :paramtype product: str + :keyword promotion_code: The Offer Promotion Code. + :paramtype promotion_code: str + """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_03_02.models.SystemData + """ -class DiskRestorePoint(ProxyOnlyResource): +class DiskRestorePoint(ProxyResource): """Properties of disk restore point. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_03_02.models.SystemData :ivar time_created: The timestamp of restorePoint creation. :vartype time_created: ~datetime.datetime :ivar source_resource_id: arm id of source disk or source disk restore point. @@ -1194,7 +1298,7 @@ class DiskRestorePoint(ProxyOnlyResource): :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2024_03_02.models.HyperVGeneration :ivar purchase_plan: Purchase plan information for the the image from which the OS disk was created. - :vartype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.PurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.DiskPurchasePlan :ivar supported_capabilities: List of supported capabilities for the image from which the OS disk was created. :vartype supported_capabilities: ~azure.mgmt.compute.v2024_03_02.models.SupportedCapabilities @@ -1237,6 +1341,7 @@ class DiskRestorePoint(ProxyOnlyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "time_created": {"readonly": True}, "source_resource_id": {"readonly": True}, "os_type": {"readonly": True}, @@ -1252,11 +1357,12 @@ class DiskRestorePoint(ProxyOnlyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "time_created": {"key": "properties.timeCreated", "type": "iso-8601"}, "source_resource_id": {"key": "properties.sourceResourceId", "type": "str"}, "os_type": {"key": "properties.osType", "type": "str"}, "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "purchase_plan": {"key": "properties.purchasePlan", "type": "PurchasePlan"}, + "purchase_plan": {"key": "properties.purchasePlan", "type": "DiskPurchasePlan"}, "supported_capabilities": {"key": "properties.supportedCapabilities", "type": "SupportedCapabilities"}, "family_id": {"key": "properties.familyId", "type": "str"}, "source_unique_id": {"key": "properties.sourceUniqueId", "type": "str"}, @@ -1276,7 +1382,7 @@ def __init__( self, *, hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - purchase_plan: Optional["_models.PurchasePlan"] = None, + purchase_plan: Optional["_models.DiskPurchasePlan"] = None, supported_capabilities: Optional["_models.SupportedCapabilities"] = None, supports_hibernation: Optional[bool] = None, network_access_policy: Optional[Union[str, "_models.NetworkAccessPolicy"]] = None, @@ -1292,7 +1398,7 @@ def __init__( :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2024_03_02.models.HyperVGeneration :keyword purchase_plan: Purchase plan information for the the image from which the OS disk was created. - :paramtype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.PurchasePlan + :paramtype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.DiskPurchasePlan :keyword supported_capabilities: List of supported capabilities for the image from which the OS disk was created. :paramtype supported_capabilities: ~azure.mgmt.compute.v2024_03_02.models.SupportedCapabilities @@ -1316,24 +1422,24 @@ def __init__( :paramtype security_profile: ~azure.mgmt.compute.v2024_03_02.models.DiskSecurityProfile """ super().__init__(**kwargs) - self.time_created = None - self.source_resource_id = None - self.os_type = None + self.time_created: Optional[datetime.datetime] = None + self.source_resource_id: Optional[str] = None + self.os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None self.hyper_v_generation = hyper_v_generation self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities - self.family_id = None - self.source_unique_id = None - self.encryption = None + self.family_id: Optional[str] = None + self.source_unique_id: Optional[str] = None + self.encryption: Optional["_models.Encryption"] = None self.supports_hibernation = supports_hibernation self.network_access_policy = network_access_policy self.public_network_access = public_network_access self.disk_access_id = disk_access_id self.completion_percent = completion_percent - self.replication_state = None - self.source_resource_location = None + self.replication_state: Optional[str] = None + self.source_resource_location: Optional[str] = None self.security_profile = security_profile - self.logical_sector_size = None + self.logical_sector_size: Optional[int] = None class DiskRestorePointList(_serialization.Model): @@ -1341,10 +1447,9 @@ class DiskRestorePointList(_serialization.Model): All required parameters must be populated in order to send to server. - :ivar value: A list of disk restore points. Required. + :ivar value: The DiskRestorePoint items on this page. Required. :vartype value: list[~azure.mgmt.compute.v2024_03_02.models.DiskRestorePoint] - :ivar next_link: The uri to fetch the next page of disk restore points. Call ListNext() with - this to fetch the next page of disk restore points. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -1361,10 +1466,9 @@ def __init__( self, *, value: List["_models.DiskRestorePoint"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: A list of disk restore points. Required. + :keyword value: The DiskRestorePoint items on this page. Required. :paramtype value: list[~azure.mgmt.compute.v2024_03_02.models.DiskRestorePoint] - :keyword next_link: The uri to fetch the next page of disk restore points. Call ListNext() with - this to fetch the next page of disk restore points. + :keyword next_link: The link to the next page of items. :paramtype next_link: str """ super().__init__(**kwargs) @@ -1442,7 +1546,7 @@ def __init__(self, *, name: Optional[Union[str, "_models.DiskStorageAccountTypes """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class DiskUpdate(_serialization.Model): @@ -1500,7 +1604,7 @@ class DiskUpdate(_serialization.Model): target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. :vartype bursting_enabled: bool :ivar purchase_plan: Purchase plan information to be added on the OS disk. - :vartype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.PurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.DiskPurchasePlan :ivar supported_capabilities: List of supported capabilities to be added on the OS disk. :vartype supported_capabilities: ~azure.mgmt.compute.v2024_03_02.models.SupportedCapabilities :ivar property_updates_in_progress: Properties of the disk for which update is pending. @@ -1547,7 +1651,7 @@ class DiskUpdate(_serialization.Model): "disk_access_id": {"key": "properties.diskAccessId", "type": "str"}, "tier": {"key": "properties.tier", "type": "str"}, "bursting_enabled": {"key": "properties.burstingEnabled", "type": "bool"}, - "purchase_plan": {"key": "properties.purchasePlan", "type": "PurchasePlan"}, + "purchase_plan": {"key": "properties.purchasePlan", "type": "DiskPurchasePlan"}, "supported_capabilities": {"key": "properties.supportedCapabilities", "type": "SupportedCapabilities"}, "property_updates_in_progress": { "key": "properties.propertyUpdatesInProgress", @@ -1577,7 +1681,7 @@ def __init__( disk_access_id: Optional[str] = None, tier: Optional[str] = None, bursting_enabled: Optional[bool] = None, - purchase_plan: Optional["_models.PurchasePlan"] = None, + purchase_plan: Optional["_models.DiskPurchasePlan"] = None, supported_capabilities: Optional["_models.SupportedCapabilities"] = None, supports_hibernation: Optional[bool] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, @@ -1637,7 +1741,7 @@ def __init__( target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. :paramtype bursting_enabled: bool :keyword purchase_plan: Purchase plan information to be added on the OS disk. - :paramtype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.PurchasePlan + :paramtype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.DiskPurchasePlan :keyword supported_capabilities: List of supported capabilities to be added on the OS disk. :paramtype supported_capabilities: ~azure.mgmt.compute.v2024_03_02.models.SupportedCapabilities :keyword supports_hibernation: Indicates the OS on a disk supports hibernation. @@ -1675,7 +1779,7 @@ def __init__( self.bursting_enabled = bursting_enabled self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities - self.property_updates_in_progress = None + self.property_updates_in_progress: Optional["_models.PropertyUpdatesInProgress"] = None self.supports_hibernation = supports_hibernation self.public_network_access = public_network_access self.data_access_auth_mode = data_access_auth_mode @@ -1742,7 +1846,7 @@ class EncryptionSetIdentity(_serialization.Model): :vartype tenant_id: str :ivar user_assigned_identities: The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2024_03_02.models.UserAssignedIdentitiesValue] """ @@ -1776,14 +1880,14 @@ def __init__( :keyword user_assigned_identities: The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2024_03_02.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) self.type = type - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.user_assigned_identities = user_assigned_identities @@ -1916,7 +2020,8 @@ class GrantAccessData(_serialization.Model): All required parameters must be populated in order to send to server. - :ivar access: Required. Known values are: "None", "Read", and "Write". + :ivar access: The Access Level, accepted values include None, Read, Write. Required. Known + values are: "None", "Read", and "Write". :vartype access: str or ~azure.mgmt.compute.v2024_03_02.models.AccessLevel :ivar duration_in_seconds: Time duration in seconds until the SAS access expires. Required. :vartype duration_in_seconds: int @@ -1950,7 +2055,8 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword access: Required. Known values are: "None", "Read", and "Write". + :keyword access: The Access Level, accepted values include None, Read, Write. Required. Known + values are: "None", "Read", and "Write". :paramtype access: str or ~azure.mgmt.compute.v2024_03_02.models.AccessLevel :keyword duration_in_seconds: Time duration in seconds until the SAS access expires. Required. :paramtype duration_in_seconds: int @@ -2175,20 +2281,25 @@ class PrivateEndpoint(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None -class PrivateEndpointConnection(_serialization.Model): +class PrivateEndpointConnection(ProxyResource): """The Private Endpoint Connection resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: private endpoint connection Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: private endpoint connection name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: private endpoint connection type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_03_02.models.SystemData :ivar private_endpoint: The resource of private end point. :vartype private_endpoint: ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpoint :ivar private_link_service_connection_state: A collection of information about the state of the @@ -2205,6 +2316,7 @@ class PrivateEndpointConnection(_serialization.Model): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "private_endpoint": {"readonly": True}, "provisioning_state": {"readonly": True}, } @@ -2213,6 +2325,7 @@ class PrivateEndpointConnection(_serialization.Model): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, "private_link_service_connection_state": { "key": "properties.privateLinkServiceConnectionState", @@ -2234,41 +2347,38 @@ def __init__( ~azure.mgmt.compute.v2024_03_02.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.private_endpoint = None + self.private_endpoint: Optional["_models.PrivateEndpoint"] = None self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None class PrivateEndpointConnectionListResult(_serialization.Model): """A list of private link resources. - :ivar value: Array of private endpoint connections. + All required parameters must be populated in order to send to server. + + :ivar value: The PrivateEndpointConnection items on this page. Required. :vartype value: list[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] - :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.PrivateEndpointConnection"]] = None, - next_link: Optional[str] = None, - **kwargs: Any + self, *, value: List["_models.PrivateEndpointConnection"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: Array of private endpoint connections. + :keyword value: The PrivateEndpointConnection items on this page. Required. :paramtype value: list[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] - :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. + :keyword next_link: The link to the next page of items. :paramtype next_link: str """ super().__init__(**kwargs) @@ -2318,11 +2428,11 @@ def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: :paramtype required_zone_names: list[str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.group_id = None - self.required_members = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.group_id: Optional[str] = None + self.required_members: Optional[List[str]] = None self.required_zone_names = required_zone_names @@ -2414,54 +2524,53 @@ def __init__(self, *, target_tier: Optional[str] = None, **kwargs: Any) -> None: self.target_tier = target_tier -class PurchasePlan(_serialization.Model): - """Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. +class ResourceAutoGenerated(_serialization.Model): + """The Resource model definition. + + 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 server. - :ivar name: The plan ID. Required. + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. :vartype name: str - :ivar publisher: The publisher ID. Required. - :vartype publisher: str - :ivar product: Specifies the product of the image from the marketplace. This is the same value - as Offer under the imageReference element. Required. - :vartype product: str - :ivar promotion_code: The Offer Promotion Code. - :vartype promotion_code: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] """ _validation = { - "name": {"required": True}, - "publisher": {"required": True}, - "product": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "product": {"key": "product", "type": "str"}, - "promotion_code": {"key": "promotionCode", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__( - self, *, name: str, publisher: str, product: str, promotion_code: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword name: The plan ID. Required. - :paramtype name: str - :keyword publisher: The publisher ID. Required. - :paramtype publisher: str - :keyword product: Specifies the product of the image from the marketplace. This is the same - value as Offer under the imageReference element. Required. - :paramtype product: str - :keyword promotion_code: The Offer Promotion Code. - :paramtype promotion_code: str + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.name = name - self.publisher = publisher - self.product = product - self.promotion_code = promotion_code + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location = location + self.tags = tags class ResourceUriList(_serialization.Model): @@ -2540,9 +2649,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s """ super().__init__(**kwargs) self.location = location - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -2566,26 +2675,31 @@ class ShareInfoElement(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.vm_uri = None + self.vm_uri: Optional[str] = None -class Snapshot(Resource): +class Snapshot(TrackedResource): """Snapshot 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_03_02.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar managed_by: Unused. Always Null. :vartype managed_by: str :ivar sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is @@ -2604,7 +2718,7 @@ class Snapshot(Resource): :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2024_03_02.models.HyperVGeneration :ivar purchase_plan: Purchase plan information for the image from which the source disk for the snapshot was originally created. - :vartype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.PurchasePlan + :vartype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.DiskPurchasePlan :ivar supported_capabilities: List of supported capabilities for the image from which the source disk from the snapshot was originally created. :vartype supported_capabilities: ~azure.mgmt.compute.v2024_03_02.models.SupportedCapabilities @@ -2669,6 +2783,7 @@ class Snapshot(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "managed_by": {"readonly": True}, "time_created": {"readonly": True}, @@ -2683,15 +2798,16 @@ class Snapshot(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "managed_by": {"key": "managedBy", "type": "str"}, "sku": {"key": "sku", "type": "SnapshotSku"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "time_created": {"key": "properties.timeCreated", "type": "iso-8601"}, "os_type": {"key": "properties.osType", "type": "str"}, "hyper_v_generation": {"key": "properties.hyperVGeneration", "type": "str"}, - "purchase_plan": {"key": "properties.purchasePlan", "type": "PurchasePlan"}, + "purchase_plan": {"key": "properties.purchasePlan", "type": "DiskPurchasePlan"}, "supported_capabilities": {"key": "properties.supportedCapabilities", "type": "SupportedCapabilities"}, "creation_data": {"key": "properties.creationData", "type": "CreationData"}, "disk_size_gb": {"key": "properties.diskSizeGB", "type": "int"}, @@ -2725,7 +2841,7 @@ def __init__( # pylint: disable=too-many-locals extended_location: Optional["_models.ExtendedLocation"] = None, os_type: Optional[Union[str, "_models.OperatingSystemTypes"]] = None, hyper_v_generation: Optional[Union[str, "_models.HyperVGeneration"]] = None, - purchase_plan: Optional["_models.PurchasePlan"] = None, + purchase_plan: Optional["_models.DiskPurchasePlan"] = None, supported_capabilities: Optional["_models.SupportedCapabilities"] = None, creation_data: Optional["_models.CreationData"] = None, disk_size_gb: Optional[int] = None, @@ -2743,10 +2859,10 @@ def __init__( # pylint: disable=too-many-locals **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot. @@ -2761,7 +2877,7 @@ def __init__( # pylint: disable=too-many-locals :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2024_03_02.models.HyperVGeneration :keyword purchase_plan: Purchase plan information for the image from which the source disk for the snapshot was originally created. - :paramtype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.PurchasePlan + :paramtype purchase_plan: ~azure.mgmt.compute.v2024_03_02.models.DiskPurchasePlan :keyword supported_capabilities: List of supported capabilities for the image from which the source disk from the snapshot was originally created. :paramtype supported_capabilities: ~azure.mgmt.compute.v2024_03_02.models.SupportedCapabilities @@ -2809,24 +2925,24 @@ def __init__( # pylint: disable=too-many-locals :paramtype data_access_auth_mode: str or ~azure.mgmt.compute.v2024_03_02.models.DataAccessAuthMode """ - super().__init__(location=location, tags=tags, **kwargs) - self.managed_by = None + super().__init__(tags=tags, location=location, **kwargs) + self.managed_by: Optional[str] = None self.sku = sku self.extended_location = extended_location - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.os_type = os_type self.hyper_v_generation = hyper_v_generation self.purchase_plan = purchase_plan self.supported_capabilities = supported_capabilities self.creation_data = creation_data self.disk_size_gb = disk_size_gb - self.disk_size_bytes = None - self.disk_state = None - self.unique_id = None + self.disk_size_bytes: Optional[int] = None + self.disk_state: Optional[Union[str, "_models.DiskState"]] = None + self.unique_id: Optional[str] = None self.encryption_settings_collection = encryption_settings_collection - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.incremental = incremental - self.incremental_snapshot_family_id = None + self.incremental_snapshot_family_id: Optional[str] = None self.encryption = encryption self.network_access_policy = network_access_policy self.disk_access_id = disk_access_id @@ -2845,8 +2961,7 @@ class SnapshotList(_serialization.Model): :ivar value: A list of snapshots. Required. :vartype value: list[~azure.mgmt.compute.v2024_03_02.models.Snapshot] - :ivar next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -2863,8 +2978,7 @@ def __init__(self, *, value: List["_models.Snapshot"], next_link: Optional[str] """ :keyword value: A list of snapshots. Required. :paramtype value: list[~azure.mgmt.compute.v2024_03_02.models.Snapshot] - :keyword next_link: The uri to fetch the next page of snapshots. Call ListNext() with this to - fetch the next page of snapshots. + :keyword next_link: The link to the next page of items. :paramtype next_link: str """ super().__init__(**kwargs) @@ -2904,7 +3018,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.tier = None + self.tier: Optional[str] = None class SnapshotUpdate(_serialization.Model): @@ -3104,7 +3218,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class SupportedCapabilities(_serialization.Model): @@ -3153,6 +3267,70 @@ def __init__( class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.compute.v2024_03_02.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.compute.v2024_03_02.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.compute.v2024_03_02.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.compute.v2024_03_02.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class SystemDataAutoGenerated(_serialization.Model): """The system meta data relating to this resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -3178,8 +3356,8 @@ class SystemData(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.created_at = None - self.last_modified_at = None + self.created_at: Optional[datetime.datetime] = None + self.last_modified_at: Optional[datetime.datetime] = None class UserAssignedIdentitiesValue(_serialization.Model): @@ -3206,5 +3384,33 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None + + +class UserAssignedIdentitiesValueAutoGenerated(_serialization.Model): + """UserAssignedIdentitiesValueAutoGenerated. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/operations/__init__.py index 0e0c2d8aaf8d..e14bc6862637 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/operations/__init__.py @@ -12,22 +12,22 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._operations import DisksOperations # type: ignore from ._operations import DiskAccessesOperations # type: ignore from ._operations import DiskEncryptionSetsOperations # type: ignore -from ._operations import DiskRestorePointOperations # type: ignore +from ._operations import DisksOperations # type: ignore from ._operations import SnapshotsOperations # type: ignore +from ._operations import DiskRestorePointOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "DisksOperations", "DiskAccessesOperations", "DiskEncryptionSetsOperations", - "DiskRestorePointOperations", + "DisksOperations", "SnapshotsOperations", + "DiskRestorePointOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/operations/_operations.py index edb0607d7879..9a05244c186b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_03_02/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,25 +42,17 @@ _SERIALIZER.client_side_validation = False -def build_disks_create_or_update_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_disk_accesses_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -71,32 +61,30 @@ def build_disks_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_update_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +def build_disk_accesses_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -105,15 +93,13 @@ def build_disks_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_get_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +def build_disk_accesses_get_request( + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -124,12 +110,14 @@ def build_disks_get_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -143,21 +131,27 @@ def build_disks_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_delete_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +def build_disk_accesses_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -165,26 +159,35 @@ def build_disks_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any + +def build_disk_accesses_update_request( + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -193,12 +196,16 @@ def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_disk_accesses_delete_request( + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -206,9 +213,16 @@ def build_disks_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -219,28 +233,29 @@ def build_disks_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_grant_access_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +def build_disk_accesses_list_private_endpoint_connections_request( # pylint: disable=name-too-long + resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -249,28 +264,38 @@ def build_disks_grant_access_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disks_revoke_access_request( - resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +def build_disk_accesses_get_a_private_endpoint_connection_request( # pylint: disable=name-too-long + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -278,11 +303,18 @@ def build_disks_revoke_access_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +def build_disk_accesses_update_a_private_endpoint_connection_request( # pylint: disable=name-too-long + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -294,12 +326,17 @@ def build_disk_accesses_create_or_update_request( # pylint: disable=name-too-lo # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -315,25 +352,33 @@ def build_disk_accesses_create_or_update_request( # pylint: disable=name-too-lo return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_update_request( - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +def build_disk_accesses_delete_a_private_endpoint_connection_request( # pylint: disable=name-too-long + resource_group_name: str, + disk_access_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -342,14 +387,12 @@ def build_disk_accesses_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_get_request( +def build_disk_accesses_get_private_link_resources_request( # pylint: disable=name-too-long resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -361,11 +404,13 @@ def build_disk_accesses_get_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privatelinkresources", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), } @@ -380,9 +425,7 @@ def build_disk_accesses_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_delete_request( - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_disk_encryption_sets_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -390,14 +433,9 @@ def build_disk_accesses_delete_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -408,10 +446,10 @@ def build_disk_accesses_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_list_by_resource_group_request( # pylint: disable=name-too-long +def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disable=name-too-long resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -423,11 +461,13 @@ def build_disk_accesses_list_by_resource_group_request( # pylint: disable=name- # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -441,7 +481,9 @@ def build_disk_accesses_list_by_resource_group_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_disk_encryption_sets_get_request( + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -449,9 +491,16 @@ def build_disk_accesses_list_request(subscription_id: str, **kwargs: Any) -> Htt accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -465,24 +514,27 @@ def build_disk_accesses_list_request(subscription_id: str, **kwargs: Any) -> Htt return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_get_private_link_resources_request( # pylint: disable=name-too-long - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any +def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -491,17 +543,15 @@ def build_disk_accesses_get_private_link_resources_request( # pylint: disable=n _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_update_a_private_endpoint_connection_request( # pylint: disable=name-too-long - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any +def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -513,15 +563,14 @@ def build_disk_accesses_update_a_private_endpoint_connection_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -534,15 +583,11 @@ def build_disk_accesses_update_a_private_endpoint_connection_request( # pylint: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_get_a_private_endpoint_connection_request( # pylint: disable=name-too-long - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any +def build_disk_encryption_sets_delete_request( # pylint: disable=name-too-long + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -553,15 +598,14 @@ def build_disk_accesses_get_a_private_endpoint_connection_request( # pylint: di # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -572,15 +616,11 @@ def build_disk_accesses_get_a_private_endpoint_connection_request( # pylint: di # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_delete_a_private_endpoint_connection_request( # pylint: disable=name-too-long - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any +def build_disk_encryption_sets_list_associated_resources_request( # pylint: disable=name-too-long + resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -591,15 +631,14 @@ def build_disk_accesses_delete_a_private_endpoint_connection_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -610,12 +649,10 @@ def build_disk_accesses_delete_a_private_endpoint_connection_request( # pylint: # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_accesses_list_private_endpoint_connections_request( # pylint: disable=name-too-long - resource_group_name: str, disk_access_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_disks_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -623,14 +660,9 @@ def build_disk_accesses_list_private_endpoint_connections_request( # pylint: di accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -644,25 +676,25 @@ def build_disk_accesses_list_private_endpoint_connections_request( # pylint: di return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +def build_disks_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -671,32 +703,31 @@ def build_disk_encryption_sets_create_or_update_request( # pylint: disable=name _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +def build_disks_get_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -705,31 +736,32 @@ def build_disk_encryption_sets_update_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_get_request( - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +def build_disks_create_or_update_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -738,29 +770,34 @@ def build_disk_encryption_sets_get_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_delete_request( # pylint: disable=name-too-long - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +def build_disks_update_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -769,13 +806,15 @@ def build_disk_encryption_sets_delete_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_disks_delete_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -786,11 +825,14 @@ def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disabl # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -801,20 +843,30 @@ def build_disk_encryption_sets_list_by_resource_group_request( # pylint: disabl # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_disks_grant_access_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -823,13 +875,15 @@ def build_disk_encryption_sets_list_request(subscription_id: str, **kwargs: Any) _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_encryption_sets_list_associated_resources_request( # pylint: disable=name-too-long - resource_group_name: str, disk_encryption_set_name: str, subscription_id: str, **kwargs: Any +def build_disks_revoke_access_request( + resource_group_name: str, disk_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -840,12 +894,14 @@ def build_disk_encryption_sets_list_associated_resources_request( # pylint: dis # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "diskName": _SERIALIZER.url("disk_name", disk_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -856,17 +912,10 @@ def build_disk_encryption_sets_list_associated_resources_request( # pylint: dis # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_restore_point_get_request( - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_snapshots_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -874,18 +923,9 @@ def build_disk_restore_point_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" - ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -899,12 +939,8 @@ def build_disk_restore_point_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_restore_point_list_by_restore_point_request( # pylint: disable=name-too-long - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - subscription_id: str, - **kwargs: Any +def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -915,15 +951,13 @@ def build_disk_restore_point_list_by_restore_point_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -937,34 +971,26 @@ def build_disk_restore_point_list_by_restore_point_request( # pylint: disable=n return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_restore_point_grant_access_request( # pylint: disable=name-too-long - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - subscription_id: str, - **kwargs: Any +def build_snapshots_get_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -973,40 +999,32 @@ def build_disk_restore_point_grant_access_request( # pylint: disable=name-too-l _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_disk_restore_point_revoke_access_request( # pylint: disable=name-too-long - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - subscription_id: str, - **kwargs: Any +def build_snapshots_create_or_update_request( + resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), - "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1015,12 +1033,14 @@ def build_disk_restore_point_revoke_access_request( # pylint: disable=name-too- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_create_or_update_request( +def build_snapshots_update_request( resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1034,10 +1054,12 @@ def build_snapshots_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } @@ -1051,27 +1073,28 @@ def build_snapshots_create_or_update_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_update_request( +def build_snapshots_delete_request( resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } @@ -1081,30 +1104,31 @@ def build_snapshots_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_get_request( +def build_snapshots_grant_access_request( resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } @@ -1114,25 +1138,32 @@ def build_snapshots_get_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_delete_request( +def build_snapshots_revoke_access_request( resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endgetaccess", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), } @@ -1141,11 +1172,18 @@ def build_snapshots_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any + +def build_disk_restore_point_list_by_restore_point_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1156,11 +1194,17 @@ def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too- # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1174,7 +1218,14 @@ def build_snapshots_list_by_resource_group_request( # pylint: disable=name-too- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_disk_restore_point_get_request( + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1182,9 +1233,20 @@ def build_snapshots_list_request(subscription_id: str, **kwargs: Any) -> HttpReq accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1198,8 +1260,13 @@ def build_snapshots_list_request(subscription_id: str, **kwargs: Any) -> HttpReq return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_grant_access_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +def build_disk_restore_point_grant_access_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1211,12 +1278,18 @@ def build_snapshots_grant_access_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1232,21 +1305,35 @@ def build_snapshots_grant_access_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_snapshots_revoke_access_request( - resource_group_name: str, snapshot_name: str, subscription_id: str, **kwargs: Any +def build_disk_restore_point_revoke_access_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-02")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, "str"), + "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1254,31 +1341,247 @@ def build_snapshots_revoke_access_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class DisksOperations: + +class DiskAccessesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.v2024_03_02.ComputeManagementClient`'s - :attr:`disks` attribute. + :attr:`disk_accesses` attribute. """ models = _models def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.DiskAccess"]: + """Lists all the disk access resources under a subscription. + + :return: An iterator like instance of either DiskAccess or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskAccessList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_accesses_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DiskAccessList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.DiskAccess"]: + """Lists all the disk access resources under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either DiskAccess or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskAccessList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_accesses_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DiskAccessList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _models.DiskAccess: + """Gets information about a disk access resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: DiskAccess or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.DiskAccess + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) + + _request = build_disk_accesses_get_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + def _create_or_update_initial( - self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + disk_access_name: str, + disk_access: Union[_models.DiskAccess, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1298,14 +1601,14 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(disk, (IOBase, bytes)): - _content = disk + if isinstance(disk_access, (IOBase, bytes)): + _content = disk_access else: - _json = self._serialize.body(disk, "Disk") + _json = self._serialize.body(disk_access, "DiskAccess") - _request = build_disks_create_or_update_request( + _request = build_disk_accesses_create_or_update_request( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -1332,10 +1635,15 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -1343,27 +1651,29 @@ def _create_or_update_initial( def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - disk: _models.Disk, + disk_access_name: str, + disk_access: _models.DiskAccess, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Disk]: - """Creates or updates a disk. + ) -> LROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: ~azure.mgmt.compute.v2024_03_02.models.Disk + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Required. + :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccess :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -1371,47 +1681,54 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - disk_name: str, - disk: IO[bytes], + disk_access_name: str, + disk_access: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Disk]: - """Creates or updates a disk. + ) -> LROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Required. - :type disk: IO[bytes] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Required. + :type disk_access: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def begin_create_or_update( - self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Disk]: - """Creates or updates a disk. + self, + resource_group_name: str, + disk_access_name: str, + disk_access: Union[_models.DiskAccess, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DiskAccess]: + """Creates or updates a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Put disk operation. Is either a Disk type - or a IO[bytes] type. Required. - :type disk: ~azure.mgmt.compute.v2024_03_02.models.Disk or IO[bytes] - :return: An instance of LROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Put disk access operation. + Is either a DiskAccess type or a IO[bytes] type. Required. + :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccess or IO[bytes] + :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1419,15 +1736,15 @@ def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, + disk_access_name=disk_access_name, + disk_access=disk_access, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1439,30 +1756,36 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Disk", pipeline_response.http_response) + deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.Disk].from_continuation_token( + return LROPoller[_models.DiskAccess].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Disk]( + return LROPoller[_models.DiskAccess]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) def _update_initial( - self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + disk_access_name: str, + disk_access: Union[_models.DiskAccessUpdate, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1482,14 +1805,14 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(disk, (IOBase, bytes)): - _content = disk + if isinstance(disk_access, (IOBase, bytes)): + _content = disk_access else: - _json = self._serialize.body(disk, "DiskUpdate") + _json = self._serialize.body(disk_access, "DiskAccessUpdate") - _request = build_disks_update_request( + _request = build_disk_accesses_update_request( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -1516,10 +1839,15 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -1527,27 +1855,29 @@ def _update_initial( def begin_update( self, resource_group_name: str, - disk_name: str, - disk: _models.DiskUpdate, + disk_access_name: str, + disk_access: _models.DiskAccessUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Disk]: - """Updates (patches) a disk. + ) -> LROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: ~azure.mgmt.compute.v2024_03_02.models.DiskUpdate + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + Required. + :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccessUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -1555,47 +1885,54 @@ def begin_update( def begin_update( self, resource_group_name: str, - disk_name: str, - disk: IO[bytes], + disk_access_name: str, + disk_access: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Disk]: - """Updates (patches) a disk. + ) -> LROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Required. - :type disk: IO[bytes] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + Required. + :type disk_access: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def begin_update( - self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Disk]: - """Updates (patches) a disk. + self, + resource_group_name: str, + disk_access_name: str, + disk_access: Union[_models.DiskAccessUpdate, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DiskAccess]: + """Updates (patches) a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param disk: Disk object supplied in the body of the Patch disk operation. Is either a - DiskUpdate type or a IO[bytes] type. Required. - :type disk: ~azure.mgmt.compute.v2024_03_02.models.DiskUpdate or IO[bytes] - :return: An instance of LROPoller that returns either Disk or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param disk_access: disk access object supplied in the body of the Patch disk access operation. + Is either a DiskAccessUpdate type or a IO[bytes] type. Required. + :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccessUpdate or IO[bytes] + :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1603,15 +1940,15 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, - disk_name=disk_name, - disk=disk, + disk_access_name=disk_access_name, + disk_access=disk_access, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1623,42 +1960,31 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Disk", pipeline_response.http_response) + deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.Disk].from_continuation_token( + return LROPoller[_models.DiskAccess].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Disk]( + return LROPoller[_models.DiskAccess]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _models.Disk: - """Gets information about a disk. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: Disk or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.Disk - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1671,11 +1997,11 @@ def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _model _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.Disk] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_disks_get_request( + _request = build_disk_accesses_delete_request( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -1683,86 +2009,49 @@ def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _model ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Disk", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + @distributed_trace + def begin_delete(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a disk access resource. - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disks_delete_request( - resource_group_name=resource_group_name, - disk_name=disk_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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=_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a disk. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1774,7 +2063,7 @@ def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1789,7 +2078,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1804,20 +2095,29 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Disk"]: - """Lists all the disks under a resource group. + def list_private_endpoint_connections( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: + """List information about private endpoint connections under a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either Disk or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.Disk] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1830,8 +2130,9 @@ 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_disks_list_by_resource_group_request( + _request = build_disk_accesses_list_private_endpoint_connections_request( resource_group_name=resource_group_name, + disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -1857,7 +2158,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("DiskList", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1881,19 +2182,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Disk"]: - """Lists all the disks under a subscription. + def get_a_private_endpoint_connection( + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets information about a private endpoint connection under a disk access resource. - :return: An iterator like instance of either Disk or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.Disk] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1902,63 +2208,47 @@ def list(self, **kwargs: Any) -> Iterable["_models.Disk"]: } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_disks_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _request = build_disk_accesses_get_a_private_endpoint_connection_request( + resource_group_name=resource_group_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - def extract_data(pipeline_response): - deserialized = self._deserialize("DiskList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore - def _grant_access_initial( + def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-long self, resource_group_name: str, - disk_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -1979,14 +2269,15 @@ def _grant_access_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data + if isinstance(private_endpoint_connection, (IOBase, bytes)): + _content = private_endpoint_connection else: - _json = self._serialize.body(grant_access_data, "GrantAccessData") + _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - _request = build_disks_grant_access_request( + _request = build_disk_accesses_update_a_private_endpoint_connection_request( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -2013,92 +2304,121 @@ def _grant_access_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_grant_access( + def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - disk_name: str, - grant_access_data: _models.GrantAccessData, + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: _models.PrivateEndpointConnection, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: + ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_grant_access( + def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - disk_name: str, - grant_access_data: IO[bytes], + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: IO[bytes] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Required. + :type private_endpoint_connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] - :raises ~azure.core.exceptions.HttpResponseError: - """ + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_grant_access( + def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long self, resource_group_name: str, - disk_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], + disk_access_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a disk. + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection under disk access resource, this can't be used + to create a new private endpoint connection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Is either a GrantAccessData type or a IO[bytes] type. Required. - :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData or IO[bytes] - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: private endpoint connection object supplied in the body of + the Put private endpoint connection operation. Is either a PrivateEndpointConnection type or a + IO[bytes] type. Required. + :type private_endpoint_connection: + ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection or IO[bytes] + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2106,15 +2426,16 @@ def begin_grant_access( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._grant_access_initial( + raw_result = self._update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, - disk_name=disk_name, - grant_access_data=grant_access_data, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -2126,7 +2447,7 @@ def begin_grant_access( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AccessUri", pipeline_response.http_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2140,17 +2461,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.AccessUri].from_continuation_token( + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.AccessUri]( + return LROPoller[_models.PrivateEndpointConnection]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> Iterator[bytes]: + def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-long + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2165,9 +2488,10 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_disks_revoke_access_request( + _request = build_disk_accesses_delete_a_private_endpoint_connection_request( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -2183,7 +2507,7 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -2191,23 +2515,33 @@ def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwa map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_revoke_access(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> LROPoller[None]: - """Revokes access to a disk. + def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long + self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a private endpoint connection under a disk access resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_name: The name of the managed disk that is being created. The name can't be changed - after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The - maximum name length is 80 characters. Required. - :type disk_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2221,9 +2555,10 @@ def begin_revoke_access(self, resource_group_name: str, disk_name: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._revoke_access_initial( + raw_result = self._delete_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, - disk_name=disk_name, + disk_access_name=disk_access_name, + private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -2254,34 +2589,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace + def get_private_link_resources( + self, resource_group_name: str, disk_access_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourceListResult: + """Gets the private link resources possible under disk access resource. -class DiskAccessesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_03_02.ComputeManagementClient`'s - :attr:`disk_accesses` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - def _create_or_update_initial( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccess, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_access_name: The name of the disk access resource that is being created. The name + can't be changed after the disk encryption set is created. Supported characters for the name + are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_access_name: str + :return: PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.PrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2290,190 +2614,275 @@ def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(disk_access, (IOBase, bytes)): - _content = disk_access - else: - _json = self._serialize.body(disk_access, "DiskAccess") + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - _request = build_disk_accesses_create_or_update_request( + _request = build_disk_accesses_get_private_link_resources_request( resource_group_name=resource_group_name, disk_access_name=disk_access_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_create_or_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: _models.DiskAccess, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiskAccess]: - """Creates or updates a disk access resource. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Required. - :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccess - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ +class DiskEncryptionSetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - @overload - def begin_create_or_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DiskAccess]: - """Creates or updates a disk access resource. + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_03_02.ComputeManagementClient`'s + :attr:`disk_encryption_sets` attribute. + """ - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Required. - :type disk_access: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] - :raises ~azure.core.exceptions.HttpResponseError: - """ + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccess, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiskAccess]: - """Creates or updates a disk access resource. + def list(self, **kwargs: Any) -> Iterable["_models.DiskEncryptionSet"]: + """Lists all the disk encryption sets under a subscription. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Put disk access operation. - Is either a DiskAccess type or a IO[bytes] type. Required. - :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccess or IO[bytes] - :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :return: An iterator like instance of either DiskEncryptionSet or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - disk_access=disk_access, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + cls: ClsType[_models.DiskEncryptionSetList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_encryption_sets_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + response = pipeline_response.http_response - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.DiskEncryptionSet"]: + """Lists all the disk encryption sets under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either DiskEncryptionSet or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskEncryptionSetList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_disk_encryption_sets_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DiskAccess].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return LROPoller[_models.DiskAccess]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any) -> _models.DiskEncryptionSet: + """Gets information about a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: DiskEncryptionSet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + + _request = build_disk_encryption_sets_get_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, ) + _request.url = self._client.format_url(_request.url) - def _update_initial( + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( self, resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccessUpdate, IO[bytes]], + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSet, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -2494,14 +2903,14 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(disk_access, (IOBase, bytes)): - _content = disk_access + if isinstance(disk_encryption_set, (IOBase, bytes)): + _content = disk_encryption_set else: - _json = self._serialize.body(disk_access, "DiskAccessUpdate") + _json = self._serialize.body(disk_encryption_set, "DiskEncryptionSet") - _request = build_disk_accesses_update_request( + _request = build_disk_encryption_sets_create_or_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -2528,92 +2937,104 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_update( + def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: _models.DiskAccessUpdate, + disk_encryption_set_name: str, + disk_encryption_set: _models.DiskEncryptionSet, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DiskAccess]: - """Updates (patches) a disk access resource. + ) -> LROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccessUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: IO[bytes], + disk_encryption_set_name: str, + disk_encryption_set: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DiskAccess]: - """Updates (patches) a disk access resource. + ) -> LROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type disk_access: IO[bytes] + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Required. + :type disk_encryption_set: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def begin_create_or_update( self, resource_group_name: str, - disk_access_name: str, - disk_access: Union[_models.DiskAccessUpdate, IO[bytes]], + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSet, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.DiskAccess]: - """Updates (patches) a disk access resource. + ) -> LROPoller[_models.DiskEncryptionSet]: + """Creates or updates a disk encryption set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param disk_access: disk access object supplied in the body of the Patch disk access operation. - Is either a DiskAccessUpdate type or a IO[bytes] type. Required. - :type disk_access: ~azure.mgmt.compute.v2024_03_02.models.DiskAccessUpdate or IO[bytes] - :return: An instance of LROPoller that returns either DiskAccess or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk + encryption set operation. Is either a DiskEncryptionSet type or a IO[bytes] type. Required. + :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet or + IO[bytes] + :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2621,15 +3042,15 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - disk_access=disk_access, + disk_encryption_set_name=disk_encryption_set_name, + disk_encryption_set=disk_encryption_set, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -2641,85 +3062,37 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) + deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.DiskAccess].from_continuation_token( + return LROPoller[_models.DiskEncryptionSet].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.DiskAccess]( + return LROPoller[_models.DiskEncryptionSet]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def get(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> _models.DiskAccess: - """Gets information about a disk access resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: DiskAccess or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.DiskAccess - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskAccess] = kwargs.pop("cls", None) - - _request = build_disk_accesses_get_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiskAccess", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> Iterator[bytes]: + def _update_initial( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2728,17 +3101,29 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_accesses_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(disk_encryption_set, (IOBase, bytes)): + _content = disk_encryption_set + else: + _json = self._serialize.body(disk_encryption_set, "DiskEncryptionSetUpdate") + + _request = build_disk_encryption_sets_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, + disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -2752,7 +3137,7 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -2760,82 +3145,290 @@ def _delete_initial(self, resource_group_name: str, disk_access_name: str, **kwa map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_delete(self, resource_group_name: str, disk_access_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a disk access resource. + @overload + def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: _models.DiskEncryptionSetUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSetUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + @overload + def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Required. + :type disk_encryption_set: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + disk_encryption_set_name: str, + disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DiskEncryptionSet]: + """Updates (patches) a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk + encryption set operation. Is either a DiskEncryptionSetUpdate type or a IO[bytes] type. + Required. + :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSetUpdate or + IO[bytes] + :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + disk_encryption_set=disk_encryption_set, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DiskEncryptionSet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DiskEncryptionSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disk_encryption_sets_delete_request( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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=_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a disk encryption set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.DiskAccess"]: - """Lists all the disk access resources under a resource group. + def list_associated_resources( + self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any + ) -> Iterable[str]: + """Lists all resources that are encrypted with this disk encryption set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either DiskAccess or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :param disk_encryption_set_name: The name of the disk encryption set that is being created. The + name can't be changed after the disk encryption set is created. Supported characters for the + name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. + :type disk_encryption_set_name: str + :return: An iterator like instance of either str or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[str] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskAccessList] = kwargs.pop("cls", None) + cls: ClsType[_models.ResourceUriList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2848,8 +3441,9 @@ 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_disk_accesses_list_by_resource_group_request( + _request = build_disk_encryption_sets_list_associated_resources_request( resource_group_name=resource_group_name, + disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -2875,7 +3469,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("DiskAccessList", pipeline_response) + deserialized = self._deserialize("ResourceUriList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2898,19 +3492,40 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + +class DisksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_03_02.ComputeManagementClient`'s + :attr:`disks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.DiskAccess"]: - """Lists all the disk access resources under a subscription. + def list(self, **kwargs: Any) -> Iterable["_models.Disk"]: + """Lists all the disks under a subscription. - :return: An iterator like instance of either DiskAccess or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskAccess] + :return: An iterator like instance of either Disk or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskAccessList] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -2923,7 +3538,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DiskAccess"]: def prepare_request(next_link=None): if not next_link: - _request = build_disk_accesses_list_request( + _request = build_disks_list_request( subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -2949,7 +3564,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("DiskAccessList", pipeline_response) + deserialized = self._deserialize("DiskList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2973,71 +3588,22 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get_private_link_resources( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> _models.PrivateLinkResourceListResult: - """Gets the private link resources possible under disk access resource. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Disk"]: + """Lists all the disks under a resource group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.PrivateLinkResourceListResult + :return: An iterator like instance of either Disk or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - _request = build_disk_accesses_get_private_link_resources_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + cls: ClsType[_models.DiskList] = kwargs.pop("cls", None) - def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3046,224 +3612,72 @@ def _update_a_private_endpoint_connection_initial( # pylint: disable=name-too-l } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_endpoint_connection, (IOBase, bytes)): - _content = private_endpoint_connection - else: - _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - - _request = build_disk_accesses_update_a_private_endpoint_connection_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _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=_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: - ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def prepare_request(next_link=None): + if not next_link: - @overload - def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. + _request = build_disks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Required. - :type private_endpoint_connection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - @distributed_trace - def begin_update_a_private_endpoint_connection( # pylint: disable=name-too-long - self, - resource_group_name: str, - disk_access_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection under disk access resource, this can't be used - to create a new private endpoint connection. + def extract_data(pipeline_response): + deserialized = self._deserialize("DiskList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: private endpoint connection object supplied in the body of - the Put private endpoint connection operation. Is either a PrivateEndpointConnection type or a - IO[bytes] type. Required. - :type private_endpoint_connection: - ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection or IO[bytes] - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def get_next(next_link=None): + _request = prepare_request(next_link) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_a_private_endpoint_connection_initial( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, - private_endpoint_connection=private_endpoint_connection, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + response = pipeline_response.http_response - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace - def get_a_private_endpoint_connection( - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets information about a private endpoint connection under a disk access resource. + def get(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> _models.Disk: + """Gets information about a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: Disk or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.Disk :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3278,12 +3692,11 @@ def get_a_private_endpoint_connection( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) - _request = build_disk_accesses_get_a_private_endpoint_connection_request( + _request = build_disks_get_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -3302,15 +3715,15 @@ def get_a_private_endpoint_connection( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + deserialized = self._deserialize("Disk", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-long - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any + def _create_or_update_initial( + self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3320,18 +3733,29 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_accesses_delete_a_private_endpoint_connection_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(disk, (IOBase, bytes)): + _content = disk + else: + _json = self._serialize.body(disk, "Disk") + + _request = build_disks_create_or_update_request( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -3345,7 +3769,7 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -3353,45 +3777,112 @@ def _delete_a_private_endpoint_connection_initial( # pylint: disable=name-too-l map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_name: str, + disk: _models.Disk, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Disk]: + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: ~azure.mgmt.compute.v2024_03_02.models.Disk + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + disk_name: str, + disk: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Disk]: + """Creates or updates a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Required. + :type disk: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long - self, resource_group_name: str, disk_access_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a private endpoint connection under a disk access resource. + def begin_create_or_update( + self, resource_group_name: str, disk_name: str, disk: Union[_models.Disk, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.Disk]: + """Creates or updates a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Put disk operation. Is either a Disk type + or a IO[bytes] type. Required. + :type disk: ~azure.mgmt.compute.v2024_03_02.models.Disk or IO[bytes] + :return: An instance of LROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_a_private_endpoint_connection_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - private_endpoint_connection_name=private_endpoint_connection_name, + disk_name=disk_name, + disk=disk, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -3400,138 +3891,33 @@ def begin_delete_a_private_endpoint_connection( # pylint: disable=name-too-long raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Disk", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.Disk].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_private_endpoint_connections( - self, resource_group_name: str, disk_access_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnection"]: - """List information about private endpoint connections under a disk access resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_access_name: The name of the disk access resource that is being created. The name - can't be changed after the disk encryption set is created. Supported characters for the name - are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_access_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_accesses_list_private_endpoint_connections_request( - resource_group_name=resource_group_name, - disk_access_name=disk_access_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class DiskEncryptionSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_03_02.ComputeManagementClient`'s - :attr:`disk_encryption_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + return LROPoller[_models.Disk]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _create_or_update_initial( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSet, IO[bytes]], - **kwargs: Any + def _update_initial( + self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3551,14 +3937,14 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(disk_encryption_set, (IOBase, bytes)): - _content = disk_encryption_set + if isinstance(disk, (IOBase, bytes)): + _content = disk else: - _json = self._serialize.body(disk_encryption_set, "DiskEncryptionSet") + _json = self._serialize.body(disk, "DiskUpdate") - _request = build_disk_encryption_sets_create_or_update_request( + _request = build_disks_update_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -3585,96 +3971,94 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: _models.DiskEncryptionSet, + disk_name: str, + disk: _models.DiskUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DiskEncryptionSet]: - """Creates or updates a disk encryption set. + ) -> LROPoller[_models.Disk]: + """Updates (patches) a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: ~azure.mgmt.compute.v2024_03_02.models.DiskUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :return: An instance of LROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: IO[bytes], + disk_name: str, + disk: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DiskEncryptionSet]: - """Creates or updates a disk encryption set. + ) -> LROPoller[_models.Disk]: + """Updates (patches) a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Required. - :type disk_encryption_set: IO[bytes] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Required. + :type disk: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :return: An instance of LROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSet, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DiskEncryptionSet]: - """Creates or updates a disk encryption set. + def begin_update( + self, resource_group_name: str, disk_name: str, disk: Union[_models.DiskUpdate, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.Disk]: + """Updates (patches) a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Put disk - encryption set operation. Is either a DiskEncryptionSet type or a IO[bytes] type. Required. - :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet or - IO[bytes] - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param disk: Disk object supplied in the body of the Patch disk operation. Is either a + DiskUpdate type or a IO[bytes] type. Required. + :type disk: ~azure.mgmt.compute.v2024_03_02.models.DiskUpdate or IO[bytes] + :return: An instance of LROPoller that returns either Disk or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Disk] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3682,15 +4066,15 @@ def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + cls: ClsType[_models.Disk] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - disk_encryption_set=disk_encryption_set, + disk_name=disk_name, + disk=disk, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3702,33 +4086,145 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) + deserialized = self._deserialize("Disk", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.DiskEncryptionSet].from_continuation_token( + return LROPoller[_models.Disk].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.DiskEncryptionSet]( + return LROPoller[_models.Disk]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _update_initial( + def _delete_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_disks_delete_request( + resource_group_name=resource_group_name, + disk_name=disk_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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=_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a disk. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + disk_name=disk_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _grant_access_initial( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, IO[bytes]], + disk_name: str, + grant_access_data: Union[_models.GrantAccessData, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -3749,14 +4245,14 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(disk_encryption_set, (IOBase, bytes)): - _content = disk_encryption_set + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data else: - _json = self._serialize.body(disk_encryption_set, "DiskEncryptionSetUpdate") + _json = self._serialize.body(grant_access_data, "GrantAccessData") - _request = build_disk_encryption_sets_update_request( + _request = build_disks_grant_access_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -3783,97 +4279,100 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_update( + def begin_grant_access( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: _models.DiskEncryptionSetUpdate, + disk_name: str, + grant_access_data: _models.GrantAccessData, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DiskEncryptionSet]: - """Updates (patches) a disk encryption set. + ) -> LROPoller[_models.AccessUri]: + """Grants access to a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSetUpdate + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_grant_access( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: IO[bytes], + disk_name: str, + grant_access_data: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DiskEncryptionSet]: - """Updates (patches) a disk encryption set. + ) -> LROPoller[_models.AccessUri]: + """Grants access to a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Required. - :type disk_encryption_set: IO[bytes] + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Required. + :type grant_access_data: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def begin_grant_access( self, resource_group_name: str, - disk_encryption_set_name: str, - disk_encryption_set: Union[_models.DiskEncryptionSetUpdate, IO[bytes]], + disk_name: str, + grant_access_data: Union[_models.GrantAccessData, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.DiskEncryptionSet]: - """Updates (patches) a disk encryption set. + ) -> LROPoller[_models.AccessUri]: + """Grants access to a disk. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :param disk_encryption_set: disk encryption set object supplied in the body of the Patch disk - encryption set operation. Is either a DiskEncryptionSetUpdate type or a IO[bytes] type. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type disk_encryption_set: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSetUpdate or - IO[bytes] - :return: An instance of LROPoller that returns either DiskEncryptionSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :type resource_group_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access + operation. Is either a GrantAccessData type or a IO[bytes] type. Required. + :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData or IO[bytes] + :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3881,15 +4380,15 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._grant_access_initial( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - disk_encryption_set=disk_encryption_set, + disk_name=disk_name, + grant_access_data=grant_access_data, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3901,87 +4400,31 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) + deserialized = self._deserialize("AccessUri", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.DiskEncryptionSet].from_continuation_token( + return LROPoller[_models.AccessUri].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.DiskEncryptionSet]( + return LROPoller[_models.AccessUri]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def get(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any) -> _models.DiskEncryptionSet: - """Gets information about a disk encryption set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskEncryptionSet] = kwargs.pop("cls", None) - - _request = build_disk_encryption_sets_get_request( - resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiskEncryptionSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> Iterator[bytes]: + def _revoke_access_initial(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3996,9 +4439,9 @@ def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_encryption_sets_delete_request( + _request = build_disks_revoke_access_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + disk_name=disk_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -4014,7 +4457,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -4022,23 +4465,29 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_delete(self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a disk encryption set. + def begin_revoke_access(self, resource_group_name: str, disk_name: str, **kwargs: Any) -> LROPoller[None]: + """Revokes access to a disk. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str + :param disk_name: The name of the managed disk that is being created. The name can't be changed + after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The + maximum name length is 80 characters. Required. + :type disk_name: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -4052,9 +4501,9 @@ def begin_delete(self, resource_group_name: str, disk_encryption_set_name: str, lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, + disk_name=disk_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -4069,7 +4518,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -4083,96 +4534,40 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.DiskEncryptionSet"]: - """Lists all the disk encryption sets under a resource group. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :return: An iterator like instance of either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskEncryptionSetList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_encryption_sets_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_03_02.ComputeManagementClient`'s + :attr:`snapshots` attribute. + """ - return pipeline_response + models = _models - return ItemPaged(get_next, extract_data) + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.DiskEncryptionSet"]: - """Lists all the disk encryption sets under a subscription. + def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: + """Lists snapshots under a subscription. - :return: An iterator like instance of either DiskEncryptionSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskEncryptionSet] + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskEncryptionSetList] = kwargs.pop("cls", None) + cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4185,7 +4580,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DiskEncryptionSet"]: def prepare_request(next_link=None): if not next_link: - _request = build_disk_encryption_sets_list_request( + _request = build_snapshots_list_request( subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -4211,7 +4606,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("DiskEncryptionSetList", pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4235,26 +4630,21 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_associated_resources( - self, resource_group_name: str, disk_encryption_set_name: str, **kwargs: Any - ) -> Iterable[str]: - """Lists all resources that are encrypted with this disk encryption set. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: + """Lists snapshots under a resource group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param disk_encryption_set_name: The name of the disk encryption set that is being created. The - name can't be changed after the disk encryption set is created. Supported characters for the - name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. Required. - :type disk_encryption_set_name: str - :return: An iterator like instance of either str or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[str] + :return: An iterator like instance of either Snapshot or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.ResourceUriList] = kwargs.pop("cls", None) + cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4267,9 +4657,8 @@ def list_associated_resources( def prepare_request(next_link=None): if not next_link: - _request = build_disk_encryption_sets_list_associated_resources_request( + _request = build_snapshots_list_by_resource_group_request( resource_group_name=resource_group_name, - disk_encryption_set_name=disk_encryption_set_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -4295,7 +4684,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceUriList", pipeline_response) + deserialized = self._deserialize("SnapshotList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -4318,50 +4707,19 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class DiskRestorePointOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_03_02.ComputeManagementClient`'s - :attr:`disk_restore_point` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - @distributed_trace - def get( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - **kwargs: Any - ) -> _models.DiskRestorePoint: - """Get disk restorePoint resource. + def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: + """Gets information about a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the disk restore point created. Required. - :type disk_restore_point_name: str - :return: DiskRestorePoint or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.DiskRestorePoint + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :return: Snapshot or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4376,13 +4734,11 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskRestorePoint] = kwargs.pop("cls", None) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - _request = build_disk_restore_point_get_request( + _request = build_snapshots_get_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -4401,108 +4757,15 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiskRestorePoint", pipeline_response.http_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_by_restore_point( - self, resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, **kwargs: Any - ) -> Iterable["_models.DiskRestorePoint"]: - """Lists diskRestorePoints under a vmRestorePoint. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :return: An iterator like instance of either DiskRestorePoint or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskRestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.DiskRestorePointList] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_disk_restore_point_list_by_restore_point_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DiskRestorePointList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _grant_access_initial( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any + def _create_or_update_initial( + self, resource_group_name: str, snapshot_name: str, snapshot: Union[_models.Snapshot, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4522,16 +4785,14 @@ def _grant_access_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(grant_access_data, (IOBase, bytes)): - _content = grant_access_data + if isinstance(snapshot, (IOBase, bytes)): + _content = snapshot else: - _json = self._serialize.body(grant_access_data, "GrantAccessData") + _json = self._serialize.body(snapshot, "Snapshot") - _request = build_disk_restore_point_grant_access_request( + _request = build_snapshots_create_or_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -4558,110 +4819,94 @@ def _grant_access_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_grant_access( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: _models.GrantAccessData, + snapshot_name: str, + snapshot: _models.Snapshot, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + ) -> LROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the disk restore point created. Required. - :type disk_restore_point_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.Snapshot :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] + :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_grant_access( + def begin_create_or_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: IO[bytes], + snapshot_name: str, + snapshot: IO[bytes], *, content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the disk restore point created. Required. - :type disk_restore_point_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Required. - :type grant_access_data: IO[bytes] + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. + :type snapshot: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] + :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_grant_access( - self, - resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, - grant_access_data: Union[_models.GrantAccessData, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.AccessUri]: - """Grants access to a diskRestorePoint. + def begin_create_or_update( + self, resource_group_name: str, snapshot_name: str, snapshot: Union[_models.Snapshot, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Creates or updates a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the disk restore point created. Required. - :type disk_restore_point_name: str - :param grant_access_data: Access data object supplied in the body of the get disk access - operation. Is either a GrantAccessData type or a IO[bytes] type. Required. - :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData or IO[bytes] - :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Put disk operation. Is either a + Snapshot type or a IO[bytes] type. Required. + :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.Snapshot or IO[bytes] + :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4669,17 +4914,15 @@ def begin_grant_access( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._grant_access_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, - grant_access_data=grant_access_data, + snapshot_name=snapshot_name, + snapshot=snapshot, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -4691,7 +4934,7 @@ def begin_grant_access( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AccessUri", pipeline_response.http_response) + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4705,22 +4948,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.AccessUri].from_continuation_token( + return LROPoller[_models.Snapshot].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.AccessUri]( + return LROPoller[_models.Snapshot]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _revoke_access_initial( + def _update_initial( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, + snapshot_name: str, + snapshot: Union[_models.SnapshotUpdate, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -4731,19 +4973,29 @@ def _revoke_access_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_disk_restore_point_revoke_access_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(snapshot, (IOBase, bytes)): + _content = snapshot + else: + _json = self._serialize.body(snapshot, "SnapshotUpdate") + + _request = build_snapshots_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -4765,53 +5017,118 @@ def _revoke_access_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: _models.SnapshotUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.SnapshotUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + snapshot_name: str, + snapshot: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. + Required. + :type snapshot: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_revoke_access( + def begin_update( self, resource_group_name: str, - restore_point_collection_name: str, - vm_restore_point_name: str, - disk_restore_point_name: str, + snapshot_name: str, + snapshot: Union[_models.SnapshotUpdate, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Revokes access to a diskRestorePoint. + ) -> LROPoller[_models.Snapshot]: + """Updates (patches) a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection that the disk - restore point belongs. Required. - :type restore_point_collection_name: str - :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point - belongs. Required. - :type vm_restore_point_name: str - :param disk_restore_point_name: The name of the disk restore point created. Required. - :type disk_restore_point_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param snapshot_name: The name of the snapshot that is being created. The name can't be changed + after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. + The max name length is 80 characters. Required. + :type snapshot_name: str + :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Is + either a SnapshotUpdate type or a IO[bytes] type. Required. + :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.SnapshotUpdate or IO[bytes] + :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._revoke_access_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - vm_restore_point_name=vm_restore_point_name, - disk_restore_point_name=disk_restore_point_name, + snapshot_name=snapshot_name, + snapshot=snapshot, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -4820,9 +5137,11 @@ def begin_revoke_access( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Snapshot", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: polling_method: PollingMethod = cast( @@ -4833,38 +5152,17 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.Snapshot].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - -class SnapshotsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_03_02.ComputeManagementClient`'s - :attr:`snapshots` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + return LROPoller[_models.Snapshot]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _create_or_update_initial( - self, resource_group_name: str, snapshot_name: str, snapshot: Union[_models.Snapshot, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: + def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4873,29 +5171,17 @@ def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(snapshot, (IOBase, bytes)): - _content = snapshot - else: - _json = self._serialize.body(snapshot, "Snapshot") - - _request = build_snapshots_create_or_update_request( + _request = build_snapshots_delete_request( resource_group_name=resource_group_name, snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -4909,7 +5195,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -4917,104 +5203,46 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: _models.Snapshot, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Creates or updates a snapshot. + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.Snapshot - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - @overload - def begin_create_or_update( - self, - resource_group_name: str, - snapshot_name: str, - snapshot: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Creates or updates a snapshot. + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Required. - :type snapshot: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore @distributed_trace - def begin_create_or_update( - self, resource_group_name: str, snapshot_name: str, snapshot: Union[_models.Snapshot, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Creates or updates a snapshot. + def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param snapshot_name: The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Put disk operation. Is either a - Snapshot type or a IO[bytes] type. Required. - :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.Snapshot or IO[bytes] - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, - snapshot=snapshot, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -5023,34 +5251,32 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.Snapshot].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Snapshot]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _update_initial( + def _grant_access_initial( self, resource_group_name: str, snapshot_name: str, - snapshot: Union[_models.SnapshotUpdate, IO[bytes]], + grant_access_data: Union[_models.GrantAccessData, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -5071,12 +5297,12 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(snapshot, (IOBase, bytes)): - _content = snapshot + if isinstance(grant_access_data, (IOBase, bytes)): + _content = grant_access_data else: - _json = self._serialize.body(snapshot, "SnapshotUpdate") + _json = self._serialize.body(grant_access_data, "GrantAccessData") - _request = build_snapshots_update_request( + _request = build_snapshots_grant_access_request( resource_group_name=resource_group_name, snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, @@ -5105,92 +5331,100 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_update( + def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - snapshot: _models.SnapshotUpdate, + grant_access_data: _models.GrantAccessData, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Updates (patches) a snapshot. + ) -> LROPoller[_models.AccessUri]: + """Grants access to a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param snapshot_name: The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.SnapshotUpdate + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - snapshot: IO[bytes], + grant_access_data: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Updates (patches) a snapshot. + ) -> LROPoller[_models.AccessUri]: + """Grants access to a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param snapshot_name: The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. - Required. - :type snapshot: IO[bytes] + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Required. + :type grant_access_data: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def begin_grant_access( self, resource_group_name: str, snapshot_name: str, - snapshot: Union[_models.SnapshotUpdate, IO[bytes]], + grant_access_data: Union[_models.GrantAccessData, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Snapshot]: - """Updates (patches) a snapshot. + ) -> LROPoller[_models.AccessUri]: + """Grants access to a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param snapshot_name: The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. Required. :type snapshot_name: str - :param snapshot: Snapshot object supplied in the body of the Patch snapshot operation. Is - either a SnapshotUpdate type or a IO[bytes] type. Required. - :type snapshot: ~azure.mgmt.compute.v2024_03_02.models.SnapshotUpdate or IO[bytes] - :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :param grant_access_data: Access data object supplied in the body of the get snapshot access + operation. Is either a GrantAccessData type or a IO[bytes] type. Required. + :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData or IO[bytes] + :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_03_02.models.AccessUri] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -5198,15 +5432,15 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) + cls: ClsType[_models.AccessUri] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._grant_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, - snapshot=snapshot, + grant_access_data=grant_access_data, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -5218,85 +5452,31 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) + deserialized = self._deserialize("AccessUri", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.Snapshot].from_continuation_token( + return LROPoller[_models.AccessUri].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Snapshot]( + return LROPoller[_models.AccessUri]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def get(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> _models.Snapshot: - """Gets information about a snapshot. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :return: Snapshot or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_03_02.models.Snapshot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - - _request = build_snapshots_get_request( - resource_group_name=resource_group_name, - snapshot_name=snapshot_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Snapshot", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> Iterator[bytes]: + def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5311,7 +5491,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_snapshots_delete_request( + _request = build_snapshots_revoke_access_request( resource_group_name=resource_group_name, snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, @@ -5329,7 +5509,7 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -5337,18 +5517,24 @@ def _delete_initial(self, resource_group_name: str, snapshot_name: str, **kwargs map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a snapshot. + def begin_revoke_access(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> LROPoller[None]: + """Revokes access to a snapshot. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param snapshot_name: The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. @@ -5367,7 +5553,7 @@ def begin_delete(self, resource_group_name: str, snapshot_name: str, **kwargs: A lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, api_version=api_version, @@ -5384,7 +5570,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -5398,21 +5586,51 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + +class DiskRestorePointOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_03_02.ComputeManagementClient`'s + :attr:`disk_restore_point` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Snapshot"]: - """Lists snapshots under a resource group. + def list_by_restore_point( + self, resource_group_name: str, restore_point_collection_name: str, vm_restore_point_name: str, **kwargs: Any + ) -> Iterable["_models.DiskRestorePoint"]: + """Lists diskRestorePoints under a vmRestorePoint. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either Snapshot or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :return: An iterator like instance of either DiskRestorePoint or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.DiskRestorePoint] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) + cls: ClsType[_models.DiskRestorePointList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5425,8 +5643,10 @@ 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_snapshots_list_by_resource_group_request( + _request = build_disk_restore_point_list_by_restore_point_request( resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -5452,7 +5672,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("SnapshotList", pipeline_response) + deserialized = self._deserialize("DiskRestorePointList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -5476,19 +5696,31 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: - """Lists snapshots under a subscription. + def get( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> _models.DiskRestorePoint: + """Get disk restorePoint resource. - :return: An iterator like instance of either Snapshot or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_03_02.models.Snapshot] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :return: DiskRestorePoint or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_03_02.models.DiskRestorePoint :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) - cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5497,62 +5729,48 @@ def list(self, **kwargs: Any) -> Iterable["_models.Snapshot"]: } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_snapshots_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) + cls: ClsType[_models.DiskRestorePoint] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _request = build_disk_restore_point_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - def extract_data(pipeline_response): - deserialized = self._deserialize("SnapshotList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("DiskRestorePoint", pipeline_response.http_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore def _grant_access_initial( self, resource_group_name: str, - snapshot_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, grant_access_data: Union[_models.GrantAccessData, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: @@ -5579,9 +5797,11 @@ def _grant_access_initial( else: _json = self._serialize.body(grant_access_data, "GrantAccessData") - _request = build_snapshots_grant_access_request( + _request = build_disk_restore_point_grant_access_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -5608,10 +5828,15 @@ def _grant_access_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -5619,21 +5844,28 @@ def _grant_access_initial( def begin_grant_access( self, resource_group_name: str, - snapshot_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, grant_access_data: _models.GrantAccessData, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AccessUri]: - """Grants access to a snapshot. + """Grants access to a diskRestorePoint. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access operation. Required. :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -5648,21 +5880,28 @@ def begin_grant_access( def begin_grant_access( self, resource_group_name: str, - snapshot_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, grant_access_data: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AccessUri]: - """Grants access to a snapshot. + """Grants access to a diskRestorePoint. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access operation. Required. :type grant_access_data: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -5677,19 +5916,26 @@ def begin_grant_access( def begin_grant_access( self, resource_group_name: str, - snapshot_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, grant_access_data: Union[_models.GrantAccessData, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.AccessUri]: - """Grants access to a snapshot. + """Grants access to a diskRestorePoint. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str - :param grant_access_data: Access data object supplied in the body of the get snapshot access + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str + :param grant_access_data: Access data object supplied in the body of the get disk access operation. Is either a GrantAccessData type or a IO[bytes] type. Required. :type grant_access_data: ~azure.mgmt.compute.v2024_03_02.models.GrantAccessData or IO[bytes] :return: An instance of LROPoller that returns either AccessUri or the result of cls(response) @@ -5708,7 +5954,9 @@ def begin_grant_access( if cont_token is None: raw_result = self._grant_access_initial( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, api_version=api_version, content_type=content_type, @@ -5745,7 +5993,14 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> Iterator[bytes]: + def _revoke_access_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5760,9 +6015,11 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-03-02")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_snapshots_revoke_access_request( + _request = build_disk_restore_point_revoke_access_request( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -5786,23 +6043,40 @@ def _revoke_access_initial(self, resource_group_name: str, snapshot_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_revoke_access(self, resource_group_name: str, snapshot_name: str, **kwargs: Any) -> LROPoller[None]: - """Revokes access to a snapshot. + def begin_revoke_access( + self, + resource_group_name: str, + restore_point_collection_name: str, + vm_restore_point_name: str, + disk_restore_point_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Revokes access to a diskRestorePoint. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param snapshot_name: The name of the snapshot that is being created. The name can't be changed - after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. - The max name length is 80 characters. Required. - :type snapshot_name: str + :param restore_point_collection_name: The name of the restore point collection that the disk + restore point belongs. Required. + :type restore_point_collection_name: str + :param vm_restore_point_name: The name of the vm restore point that the disk disk restore point + belongs. Required. + :type vm_restore_point_name: str + :param disk_restore_point_name: The name of the DiskRestorePoint. Required. + :type disk_restore_point_name: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -5818,7 +6092,9 @@ def begin_revoke_access(self, resource_group_name: str, snapshot_name: str, **kw if cont_token is None: raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, - snapshot_name=snapshot_name, + restore_point_collection_name=restore_point_collection_name, + vm_restore_point_name=vm_restore_point_name, + disk_restore_point_name=disk_restore_point_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_compute_management_client.py index 5c780f4bc783..078a22c153ef 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -56,84 +58,83 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2024_11_01.operations.Operations + :ivar availability_sets: AvailabilitySetsOperations operations + :vartype availability_sets: + azure.mgmt.compute.v2024_11_01.operations.AvailabilitySetsOperations + :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations + :vartype capacity_reservation_groups: + azure.mgmt.compute.v2024_11_01.operations.CapacityReservationGroupsOperations + :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2024_11_01.operations.DedicatedHostGroupsOperations + :ivar images: ImagesOperations operations + :vartype images: azure.mgmt.compute.v2024_11_01.operations.ImagesOperations + :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations + :vartype virtual_machine_images_edge_zone: + azure.mgmt.compute.v2024_11_01.operations.VirtualMachineImagesEdgeZoneOperations + :ivar virtual_machine_images: VirtualMachineImagesOperations operations + :vartype virtual_machine_images: + azure.mgmt.compute.v2024_11_01.operations.VirtualMachineImagesOperations + :ivar log_analytics: LogAnalyticsOperations operations + :vartype log_analytics: azure.mgmt.compute.v2024_11_01.operations.LogAnalyticsOperations + :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2024_11_01.operations.VirtualMachineExtensionImagesOperations + :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2024_11_01.operations.VirtualMachineRunCommandsOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2024_11_01.operations.UsageOperations - :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: - azure.mgmt.compute.v2024_11_01.operations.VirtualMachineSizesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2024_11_01.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations - operations - :vartype virtual_machine_scale_set_extensions: - azure.mgmt.compute.v2024_11_01.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: - VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: - azure.mgmt.compute.v2024_11_01.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations - operations - :vartype virtual_machine_scale_set_vm_extensions: - azure.mgmt.compute.v2024_11_01.operations.VirtualMachineScaleSetVMExtensionsOperations - :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: - azure.mgmt.compute.v2024_11_01.operations.VirtualMachineScaleSetVMsOperations - :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: - azure.mgmt.compute.v2024_11_01.operations.VirtualMachineExtensionsOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2024_11_01.operations.VirtualMachinesOperations - :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: - azure.mgmt.compute.v2024_11_01.operations.VirtualMachineImagesOperations - :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations - :vartype virtual_machine_images_edge_zone: - azure.mgmt.compute.v2024_11_01.operations.VirtualMachineImagesEdgeZoneOperations - :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: - azure.mgmt.compute.v2024_11_01.operations.VirtualMachineExtensionImagesOperations - :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: - azure.mgmt.compute.v2024_11_01.operations.AvailabilitySetsOperations + :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2024_11_01.operations.VirtualMachineSizesOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations :vartype proximity_placement_groups: azure.mgmt.compute.v2024_11_01.operations.ProximityPlacementGroupsOperations - :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: - azure.mgmt.compute.v2024_11_01.operations.DedicatedHostGroupsOperations - :ivar dedicated_hosts: DedicatedHostsOperations operations - :vartype dedicated_hosts: azure.mgmt.compute.v2024_11_01.operations.DedicatedHostsOperations - :ivar ssh_public_keys: SshPublicKeysOperations operations - :vartype ssh_public_keys: azure.mgmt.compute.v2024_11_01.operations.SshPublicKeysOperations - :ivar images: ImagesOperations operations - :vartype images: azure.mgmt.compute.v2024_11_01.operations.ImagesOperations :ivar restore_point_collections: RestorePointCollectionsOperations operations :vartype restore_point_collections: azure.mgmt.compute.v2024_11_01.operations.RestorePointCollectionsOperations - :ivar restore_points: RestorePointsOperations operations - :vartype restore_points: azure.mgmt.compute.v2024_11_01.operations.RestorePointsOperations - :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations - :vartype capacity_reservation_groups: - azure.mgmt.compute.v2024_11_01.operations.CapacityReservationGroupsOperations + :ivar ssh_public_keys: SshPublicKeysOperations operations + :vartype ssh_public_keys: azure.mgmt.compute.v2024_11_01.operations.SshPublicKeysOperations :ivar capacity_reservations: CapacityReservationsOperations operations :vartype capacity_reservations: azure.mgmt.compute.v2024_11_01.operations.CapacityReservationsOperations - :ivar log_analytics: LogAnalyticsOperations operations - :vartype log_analytics: azure.mgmt.compute.v2024_11_01.operations.LogAnalyticsOperations - :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: - azure.mgmt.compute.v2024_11_01.operations.VirtualMachineRunCommandsOperations + :ivar dedicated_hosts: DedicatedHostsOperations operations + :vartype dedicated_hosts: azure.mgmt.compute.v2024_11_01.operations.DedicatedHostsOperations + :ivar restore_points: RestorePointsOperations operations + :vartype restore_points: azure.mgmt.compute.v2024_11_01.operations.RestorePointsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2024_11_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2024_11_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2024_11_01.operations.VirtualMachineScaleSetVMsOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2024_11_01.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations operations :vartype virtual_machine_scale_set_vm_run_commands: azure.mgmt.compute.v2024_11_01.operations.VirtualMachineScaleSetVMRunCommandsOperations + :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2024_11_01.operations.VirtualMachineExtensionsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-11-01". Note that overriding this default value may result in unsupported behavior. @@ -143,15 +144,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -170,84 +173,84 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2024-11-01") - self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize, "2024-11-01") - self.virtual_machine_sizes = VirtualMachineSizesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-11-01" - ) - self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( + self.availability_sets = AvailabilitySetsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( + self.capacity_reservation_groups = CapacityReservationGroupsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_scale_set_rolling_upgrades = VirtualMachineScaleSetRollingUpgradesOperations( + self.dedicated_host_groups = DedicatedHostGroupsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( + self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize, "2024-11-01") + self.virtual_machine_images_edge_zone = VirtualMachineImagesEdgeZoneOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( + self.virtual_machine_images = VirtualMachineImagesOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_extensions = VirtualMachineExtensionsOperations( + self.log_analytics = LogAnalyticsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machines = VirtualMachinesOperations( + self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_images = VirtualMachineImagesOperations( + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_images_edge_zone = VirtualMachineImagesEdgeZoneOperations( + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize, "2024-11-01") + self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations( + self.virtual_machines = VirtualMachinesOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.availability_sets = AvailabilitySetsOperations( + self.virtual_machine_sizes = VirtualMachineSizesOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) self.proximity_placement_groups = ProximityPlacementGroupsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.dedicated_host_groups = DedicatedHostGroupsOperations( + self.restore_point_collections = RestorePointCollectionsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.dedicated_hosts = DedicatedHostsOperations( + self.ssh_public_keys = SshPublicKeysOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.ssh_public_keys = SshPublicKeysOperations( + self.capacity_reservations = CapacityReservationsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize, "2024-11-01") - self.restore_point_collections = RestorePointCollectionsOperations( + self.dedicated_hosts = DedicatedHostsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) self.restore_points = RestorePointsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.capacity_reservation_groups = CapacityReservationGroupsOperations( + self.virtual_machine_scale_set_rolling_upgrades = VirtualMachineScaleSetRollingUpgradesOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.capacity_reservations = CapacityReservationsOperations( + self.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.log_analytics = LogAnalyticsOperations( + self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( + self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) self.virtual_machine_scale_set_vm_run_commands = VirtualMachineScaleSetVMRunCommandsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) + self.virtual_machine_extensions = VirtualMachineExtensionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-11-01" + ) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_configuration.py index da0ddc20eae1..79bccfe20953 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_configuration.py @@ -25,8 +25,7 @@ class ComputeManagementClientConfiguration: # pylint: disable=too-many-instance :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2024-11-01". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_metadata.json index 373d6f1356a8..e12fa1516bc8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -24,7 +24,7 @@ }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true, "method_location": "positional" @@ -39,7 +39,7 @@ }, "subscription_id": { "signature": "subscription_id: str,", - "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required.", + "description": "The ID of the target subscription. Required.", "docstring_type": "str", "required": true } @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -106,30 +106,30 @@ }, "operation_groups": { "operations": "Operations", + "availability_sets": "AvailabilitySetsOperations", + "capacity_reservation_groups": "CapacityReservationGroupsOperations", + "dedicated_host_groups": "DedicatedHostGroupsOperations", + "images": "ImagesOperations", + "virtual_machine_images_edge_zone": "VirtualMachineImagesEdgeZoneOperations", + "virtual_machine_images": "VirtualMachineImagesOperations", + "log_analytics": "LogAnalyticsOperations", + "virtual_machine_extension_images": "VirtualMachineExtensionImagesOperations", + "virtual_machine_run_commands": "VirtualMachineRunCommandsOperations", "usage": "UsageOperations", - "virtual_machine_sizes": "VirtualMachineSizesOperations", "virtual_machine_scale_sets": "VirtualMachineScaleSetsOperations", - "virtual_machine_scale_set_extensions": "VirtualMachineScaleSetExtensionsOperations", - "virtual_machine_scale_set_rolling_upgrades": "VirtualMachineScaleSetRollingUpgradesOperations", - "virtual_machine_scale_set_vm_extensions": "VirtualMachineScaleSetVMExtensionsOperations", - "virtual_machine_scale_set_vms": "VirtualMachineScaleSetVMsOperations", - "virtual_machine_extensions": "VirtualMachineExtensionsOperations", "virtual_machines": "VirtualMachinesOperations", - "virtual_machine_images": "VirtualMachineImagesOperations", - "virtual_machine_images_edge_zone": "VirtualMachineImagesEdgeZoneOperations", - "virtual_machine_extension_images": "VirtualMachineExtensionImagesOperations", - "availability_sets": "AvailabilitySetsOperations", + "virtual_machine_sizes": "VirtualMachineSizesOperations", "proximity_placement_groups": "ProximityPlacementGroupsOperations", - "dedicated_host_groups": "DedicatedHostGroupsOperations", - "dedicated_hosts": "DedicatedHostsOperations", - "ssh_public_keys": "SshPublicKeysOperations", - "images": "ImagesOperations", "restore_point_collections": "RestorePointCollectionsOperations", - "restore_points": "RestorePointsOperations", - "capacity_reservation_groups": "CapacityReservationGroupsOperations", + "ssh_public_keys": "SshPublicKeysOperations", "capacity_reservations": "CapacityReservationsOperations", - "log_analytics": "LogAnalyticsOperations", - "virtual_machine_run_commands": "VirtualMachineRunCommandsOperations", - "virtual_machine_scale_set_vm_run_commands": "VirtualMachineScaleSetVMRunCommandsOperations" + "dedicated_hosts": "DedicatedHostsOperations", + "restore_points": "RestorePointsOperations", + "virtual_machine_scale_set_rolling_upgrades": "VirtualMachineScaleSetRollingUpgradesOperations", + "virtual_machine_scale_set_extensions": "VirtualMachineScaleSetExtensionsOperations", + "virtual_machine_scale_set_vms": "VirtualMachineScaleSetVMsOperations", + "virtual_machine_scale_set_vm_extensions": "VirtualMachineScaleSetVMExtensionsOperations", + "virtual_machine_scale_set_vm_run_commands": "VirtualMachineScaleSetVMRunCommandsOperations", + "virtual_machine_extensions": "VirtualMachineExtensionsOperations" } } diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/_compute_management_client.py index b0d2e626c38c..cda7a9b90e97 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -56,86 +58,85 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes :ivar operations: Operations operations :vartype operations: azure.mgmt.compute.v2024_11_01.aio.operations.Operations + :ivar availability_sets: AvailabilitySetsOperations operations + :vartype availability_sets: + azure.mgmt.compute.v2024_11_01.aio.operations.AvailabilitySetsOperations + :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations + :vartype capacity_reservation_groups: + azure.mgmt.compute.v2024_11_01.aio.operations.CapacityReservationGroupsOperations + :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2024_11_01.aio.operations.DedicatedHostGroupsOperations + :ivar images: ImagesOperations operations + :vartype images: azure.mgmt.compute.v2024_11_01.aio.operations.ImagesOperations + :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations + :vartype virtual_machine_images_edge_zone: + azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineImagesEdgeZoneOperations + :ivar virtual_machine_images: VirtualMachineImagesOperations operations + :vartype virtual_machine_images: + azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineImagesOperations + :ivar log_analytics: LogAnalyticsOperations operations + :vartype log_analytics: azure.mgmt.compute.v2024_11_01.aio.operations.LogAnalyticsOperations + :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineExtensionImagesOperations + :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineRunCommandsOperations :ivar usage: UsageOperations operations :vartype usage: azure.mgmt.compute.v2024_11_01.aio.operations.UsageOperations - :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations - :vartype virtual_machine_sizes: - azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineSizesOperations :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineScaleSetsOperations - :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations - operations - :vartype virtual_machine_scale_set_extensions: - azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineScaleSetExtensionsOperations - :ivar virtual_machine_scale_set_rolling_upgrades: - VirtualMachineScaleSetRollingUpgradesOperations operations - :vartype virtual_machine_scale_set_rolling_upgrades: - azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations - :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations - operations - :vartype virtual_machine_scale_set_vm_extensions: - azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations - :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations - :vartype virtual_machine_scale_set_vms: - azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineScaleSetVMsOperations - :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations - :vartype virtual_machine_extensions: - azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineExtensionsOperations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachinesOperations - :ivar virtual_machine_images: VirtualMachineImagesOperations operations - :vartype virtual_machine_images: - azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineImagesOperations - :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations - :vartype virtual_machine_images_edge_zone: - azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineImagesEdgeZoneOperations - :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations - :vartype virtual_machine_extension_images: - azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineExtensionImagesOperations - :ivar availability_sets: AvailabilitySetsOperations operations - :vartype availability_sets: - azure.mgmt.compute.v2024_11_01.aio.operations.AvailabilitySetsOperations + :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineSizesOperations :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations :vartype proximity_placement_groups: azure.mgmt.compute.v2024_11_01.aio.operations.ProximityPlacementGroupsOperations - :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations - :vartype dedicated_host_groups: - azure.mgmt.compute.v2024_11_01.aio.operations.DedicatedHostGroupsOperations - :ivar dedicated_hosts: DedicatedHostsOperations operations - :vartype dedicated_hosts: - azure.mgmt.compute.v2024_11_01.aio.operations.DedicatedHostsOperations - :ivar ssh_public_keys: SshPublicKeysOperations operations - :vartype ssh_public_keys: azure.mgmt.compute.v2024_11_01.aio.operations.SshPublicKeysOperations - :ivar images: ImagesOperations operations - :vartype images: azure.mgmt.compute.v2024_11_01.aio.operations.ImagesOperations :ivar restore_point_collections: RestorePointCollectionsOperations operations :vartype restore_point_collections: azure.mgmt.compute.v2024_11_01.aio.operations.RestorePointCollectionsOperations - :ivar restore_points: RestorePointsOperations operations - :vartype restore_points: azure.mgmt.compute.v2024_11_01.aio.operations.RestorePointsOperations - :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations - :vartype capacity_reservation_groups: - azure.mgmt.compute.v2024_11_01.aio.operations.CapacityReservationGroupsOperations + :ivar ssh_public_keys: SshPublicKeysOperations operations + :vartype ssh_public_keys: azure.mgmt.compute.v2024_11_01.aio.operations.SshPublicKeysOperations :ivar capacity_reservations: CapacityReservationsOperations operations :vartype capacity_reservations: azure.mgmt.compute.v2024_11_01.aio.operations.CapacityReservationsOperations - :ivar log_analytics: LogAnalyticsOperations operations - :vartype log_analytics: azure.mgmt.compute.v2024_11_01.aio.operations.LogAnalyticsOperations - :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations - :vartype virtual_machine_run_commands: - azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineRunCommandsOperations + :ivar dedicated_hosts: DedicatedHostsOperations operations + :vartype dedicated_hosts: + azure.mgmt.compute.v2024_11_01.aio.operations.DedicatedHostsOperations + :ivar restore_points: RestorePointsOperations operations + :vartype restore_points: azure.mgmt.compute.v2024_11_01.aio.operations.RestorePointsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineScaleSetVMsOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations operations :vartype virtual_machine_scale_set_vm_run_commands: azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations + :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2024_11_01.aio.operations.VirtualMachineExtensionsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-11-01". Note that overriding this default value may result in unsupported behavior. @@ -145,15 +146,17 @@ class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -172,84 +175,86 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2024-11-01") - self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize, "2024-11-01") - self.virtual_machine_sizes = VirtualMachineSizesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-11-01" - ) - self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( + self.availability_sets = AvailabilitySetsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( + self.capacity_reservation_groups = CapacityReservationGroupsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_scale_set_rolling_upgrades = VirtualMachineScaleSetRollingUpgradesOperations( + self.dedicated_host_groups = DedicatedHostGroupsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( + self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize, "2024-11-01") + self.virtual_machine_images_edge_zone = VirtualMachineImagesEdgeZoneOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( + self.virtual_machine_images = VirtualMachineImagesOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_extensions = VirtualMachineExtensionsOperations( + self.log_analytics = LogAnalyticsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machines = VirtualMachinesOperations( + self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_images = VirtualMachineImagesOperations( + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_images_edge_zone = VirtualMachineImagesEdgeZoneOperations( + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize, "2024-11-01") + self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations( + self.virtual_machines = VirtualMachinesOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.availability_sets = AvailabilitySetsOperations( + self.virtual_machine_sizes = VirtualMachineSizesOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) self.proximity_placement_groups = ProximityPlacementGroupsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.dedicated_host_groups = DedicatedHostGroupsOperations( + self.restore_point_collections = RestorePointCollectionsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.dedicated_hosts = DedicatedHostsOperations( + self.ssh_public_keys = SshPublicKeysOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.ssh_public_keys = SshPublicKeysOperations( + self.capacity_reservations = CapacityReservationsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize, "2024-11-01") - self.restore_point_collections = RestorePointCollectionsOperations( + self.dedicated_hosts = DedicatedHostsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) self.restore_points = RestorePointsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.capacity_reservation_groups = CapacityReservationGroupsOperations( + self.virtual_machine_scale_set_rolling_upgrades = VirtualMachineScaleSetRollingUpgradesOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.capacity_reservations = CapacityReservationsOperations( + self.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.log_analytics = LogAnalyticsOperations( + self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) - self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( + self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) self.virtual_machine_scale_set_vm_run_commands = VirtualMachineScaleSetVMRunCommandsOperations( self._client, self._config, self._serialize, self._deserialize, "2024-11-01" ) + self.virtual_machine_extensions = VirtualMachineExtensionsOperations( + self._client, self._config, self._serialize, self._deserialize, "2024-11-01" + ) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/_configuration.py index 5452cdff0995..65be166ddc7b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/_configuration.py @@ -25,8 +25,7 @@ class ComputeManagementClientConfiguration: # pylint: disable=too-many-instance :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2024-11-01". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/operations/__init__.py index 5cc9a11e2341..6718c8ecb4f9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/operations/__init__.py @@ -13,31 +13,31 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import Operations # type: ignore +from ._operations import AvailabilitySetsOperations # type: ignore +from ._operations import CapacityReservationGroupsOperations # type: ignore +from ._operations import DedicatedHostGroupsOperations # type: ignore +from ._operations import ImagesOperations # type: ignore +from ._operations import VirtualMachineImagesEdgeZoneOperations # type: ignore +from ._operations import VirtualMachineImagesOperations # type: ignore +from ._operations import LogAnalyticsOperations # type: ignore +from ._operations import VirtualMachineExtensionImagesOperations # type: ignore +from ._operations import VirtualMachineRunCommandsOperations # type: ignore from ._operations import UsageOperations # type: ignore -from ._operations import VirtualMachineSizesOperations # type: ignore from ._operations import VirtualMachineScaleSetsOperations # type: ignore -from ._operations import VirtualMachineScaleSetExtensionsOperations # type: ignore -from ._operations import VirtualMachineScaleSetRollingUpgradesOperations # type: ignore -from ._operations import VirtualMachineScaleSetVMExtensionsOperations # type: ignore -from ._operations import VirtualMachineScaleSetVMsOperations # type: ignore -from ._operations import VirtualMachineExtensionsOperations # type: ignore from ._operations import VirtualMachinesOperations # type: ignore -from ._operations import VirtualMachineImagesOperations # type: ignore -from ._operations import VirtualMachineImagesEdgeZoneOperations # type: ignore -from ._operations import VirtualMachineExtensionImagesOperations # type: ignore -from ._operations import AvailabilitySetsOperations # type: ignore +from ._operations import VirtualMachineSizesOperations # type: ignore from ._operations import ProximityPlacementGroupsOperations # type: ignore -from ._operations import DedicatedHostGroupsOperations # type: ignore -from ._operations import DedicatedHostsOperations # type: ignore -from ._operations import SshPublicKeysOperations # type: ignore -from ._operations import ImagesOperations # type: ignore from ._operations import RestorePointCollectionsOperations # type: ignore -from ._operations import RestorePointsOperations # type: ignore -from ._operations import CapacityReservationGroupsOperations # type: ignore +from ._operations import SshPublicKeysOperations # type: ignore from ._operations import CapacityReservationsOperations # type: ignore -from ._operations import LogAnalyticsOperations # type: ignore -from ._operations import VirtualMachineRunCommandsOperations # type: ignore +from ._operations import DedicatedHostsOperations # type: ignore +from ._operations import RestorePointsOperations # type: ignore +from ._operations import VirtualMachineScaleSetRollingUpgradesOperations # type: ignore +from ._operations import VirtualMachineScaleSetExtensionsOperations # type: ignore +from ._operations import VirtualMachineScaleSetVMsOperations # type: ignore +from ._operations import VirtualMachineScaleSetVMExtensionsOperations # type: ignore from ._operations import VirtualMachineScaleSetVMRunCommandsOperations # type: ignore +from ._operations import VirtualMachineExtensionsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -45,31 +45,31 @@ __all__ = [ "Operations", + "AvailabilitySetsOperations", + "CapacityReservationGroupsOperations", + "DedicatedHostGroupsOperations", + "ImagesOperations", + "VirtualMachineImagesEdgeZoneOperations", + "VirtualMachineImagesOperations", + "LogAnalyticsOperations", + "VirtualMachineExtensionImagesOperations", + "VirtualMachineRunCommandsOperations", "UsageOperations", - "VirtualMachineSizesOperations", "VirtualMachineScaleSetsOperations", - "VirtualMachineScaleSetExtensionsOperations", - "VirtualMachineScaleSetRollingUpgradesOperations", - "VirtualMachineScaleSetVMExtensionsOperations", - "VirtualMachineScaleSetVMsOperations", - "VirtualMachineExtensionsOperations", "VirtualMachinesOperations", - "VirtualMachineImagesOperations", - "VirtualMachineImagesEdgeZoneOperations", - "VirtualMachineExtensionImagesOperations", - "AvailabilitySetsOperations", + "VirtualMachineSizesOperations", "ProximityPlacementGroupsOperations", - "DedicatedHostGroupsOperations", - "DedicatedHostsOperations", - "SshPublicKeysOperations", - "ImagesOperations", "RestorePointCollectionsOperations", - "RestorePointsOperations", - "CapacityReservationGroupsOperations", + "SshPublicKeysOperations", "CapacityReservationsOperations", - "LogAnalyticsOperations", - "VirtualMachineRunCommandsOperations", + "DedicatedHostsOperations", + "RestorePointsOperations", + "VirtualMachineScaleSetRollingUpgradesOperations", + "VirtualMachineScaleSetExtensionsOperations", + "VirtualMachineScaleSetVMsOperations", + "VirtualMachineScaleSetVMExtensionsOperations", "VirtualMachineScaleSetVMRunCommandsOperations", + "VirtualMachineExtensionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/operations/_operations.py index c803b24faa74..553dc2662c05 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request, build_availability_sets_convert_to_virtual_machine_scale_set_request, @@ -219,11 +221,8 @@ build_virtual_machines_start_request, build_virtual_machines_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -242,27 +241,26 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.ComputeOperationValue"]: - """Gets a list of compute operations. + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. - :return: An iterator like instance of either ComputeOperationValue or the result of - cls(response) + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.ComputeOperationValue] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ComputeOperationListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -300,11 +298,11 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -324,42 +322,45 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class UsageOperations: +class AvailabilitySetsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`usage` attribute. + :attr:`availability_sets` attribute. """ models = _models def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: - """Gets, for the specified location, the current compute resource usage information as well as the - limits for compute resources under the subscription. + def list_by_subscription( + self, *, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.AvailabilitySet"]: + """Lists all availability sets in a subscription. - :param location: The location for which resource usage is queried. Required. - :type location: str - :return: An iterator like instance of either Usage or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.Usage] + :keyword expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. Default value is None. + :paramtype expand: str + :return: An iterator like instance of either AvailabilitySet or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) + cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -372,9 +373,9 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: def prepare_request(next_link=None): if not next_link: - _request = build_usage_list_request( - location=location, + _request = build_availability_sets_list_by_subscription_request( subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -399,7 +400,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("ListUsagesResult", pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -422,44 +423,23 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class VirtualMachineSizesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machine_sizes` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - @distributed_trace - def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineSize"]: - """This API is deprecated. Use `Resources Skus - `_. + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.AvailabilitySet"]: + """Lists all availability sets in a resource group. - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either AvailabilitySet or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -472,8 +452,8 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMa def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_sizes_list_request( - location=location, + _request = build_availability_sets_list_request( + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -499,11 +479,11 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -522,117 +502,19 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + @distributed_trace_async + async def get(self, resource_group_name: str, availability_set_name: str, **kwargs: Any) -> _models.AvailabilitySet: + """Retrieves information about an availability set. -class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machine_scale_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineScaleSet"]: - """Gets all the VM scale sets under the specified subscription for the specified location. - - :param location: The location for which VM scale sets under the subscription are queried. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :return: An iterator like instance of either VirtualMachineScaleSet or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machine_scale_sets_list_by_location_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _create_or_update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSet, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -641,53 +523,34 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VirtualMachineScaleSet") + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_create_or_update_request( + _request = build_availability_sets_get_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -695,174 +558,81 @@ async def _create_or_update_initial( return deserialized # type: ignore @overload - async def begin_create_or_update( + async def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VirtualMachineScaleSet, + availability_set_name: str, + parameters: _models.AvailabilitySet, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: - """Create or update a VM scale set. + ) -> _models.AvailabilitySet: + """Create or update an availability set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set to create or update. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, + availability_set_name: str, parameters: IO[bytes], *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: - """Create or update a VM scale set. + ) -> _models.AvailabilitySet: + """Create or update an availability set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set to create or update. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Required. :type parameters: IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSet, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + availability_set_name: str, + parameters: Union[_models.AvailabilitySet, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: - """Create or update a VM scale set. + ) -> _models.AvailabilitySet: + """Create or update an availability set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set to create or update. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Is either a VirtualMachineScaleSet type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet or IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Is either a + AvailabilitySet type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet or IO[bytes] + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineScaleSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSetUpdate, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -876,7 +646,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -884,14 +654,12 @@ async def _update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "VirtualMachineScaleSetUpdate") + _json = self._serialize.body(parameters, "AvailabilitySet") - _request = build_virtual_machine_scale_sets_update_request( + _request = build_availability_sets_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, api_version=api_version, content_type=content_type, json=_json, @@ -901,8 +669,7 @@ async def _update_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -910,14 +677,10 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -925,210 +688,129 @@ async def _update_initial( return deserialized # type: ignore @overload - async def begin_update( + async def update( self, resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VirtualMachineScaleSetUpdate, + availability_set_name: str, + parameters: _models.AvailabilitySetUpdate, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: - """Update a VM scale set. + ) -> _models.AvailabilitySet: + """Update an availability set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set to create or update. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetUpdate - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySetUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def update( self, resource_group_name: str, - vm_scale_set_name: str, + availability_set_name: str, parameters: IO[bytes], *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: - """Update a VM scale set. + ) -> _models.AvailabilitySet: + """Update an availability set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set to create or update. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Required. :type parameters: IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def update( self, resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSetUpdate, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + availability_set_name: str, + parameters: Union[_models.AvailabilitySetUpdate, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: - """Update a VM scale set. + ) -> _models.AvailabilitySet: + """Update an availability set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set to create or update. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Is either a VirtualMachineScaleSetUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetUpdate or - IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Is either a + AvailabilitySetUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySetUpdate or IO[bytes] + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineScaleSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + _json = self._serialize.body(parameters, "AvailabilitySetUpdate") - _request = build_virtual_machine_scale_sets_delete_request( + _request = build_availability_sets_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, - force_deletion=force_deletion, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1136,84 +818,69 @@ async def _delete_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, vm_scale_set_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a VM scale set. + async def delete(self, resource_group_name: str, availability_set_name: str, **kwargs: Any) -> None: + """Delete an availability set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :keyword force_deletion: Optional parameter to force delete a VM scale set. (Feature in - Preview). Default value is None. - :paramtype force_deletion: bool - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - force_deletion=force_deletion, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + _request = build_availability_sets_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async - async def get( - self, - resource_group_name: str, - vm_scale_set_name: str, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetVMScaleSets]] = None, - **kwargs: Any - ) -> _models.VirtualMachineScaleSet: - """Display information about a virtual machine scale set. + async def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, resource_group_name: str, availability_set_name: str, **kwargs: Any + ) -> None: + """Cancel the migration operation on an Availability Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :keyword expand: The expand expression to apply on the operation. 'UserData' retrieves the - UserData property of the VM scale set that was provided by the user during the VM scale set - Create/Update operation. "userData" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForGetVMScaleSets - :return: VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1228,13 +895,12 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_get_request( + _request = build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -1248,24 +914,18 @@ async def get( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - async def _deallocate_initial( + async def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - *, - hibernate: Optional[bool] = None, + availability_set_name: str, + parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, IO[bytes]]] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -1286,19 +946,18 @@ async def _deallocate_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + if parameters is not None: + _json = self._serialize.body(parameters, "ConvertToVirtualMachineScaleSetInput") else: _json = None - _request = build_virtual_machine_scale_sets_deallocate_request( + _request = build_availability_sets_convert_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, - hibernate=hibernate, api_version=api_version, content_type=content_type, json=_json, @@ -1316,7 +975,7 @@ async def _deallocate_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -1324,40 +983,38 @@ async def _deallocate_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_deallocate( + async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + availability_set_name: str, + parameters: Optional[_models.ConvertToVirtualMachineScaleSetInput] = None, *, - hibernate: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and - releases the compute resources. You are not billed for the compute resources that this virtual - machine scale set deallocates. + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs - :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. - (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is - None. - :paramtype hibernate: bool + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ConvertToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1367,31 +1024,26 @@ async def begin_deallocate( """ @overload - async def begin_deallocate( + async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, + availability_set_name: str, + parameters: Optional[IO[bytes]] = None, *, - hibernate: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and - releases the compute resources. You are not billed for the compute resources that this virtual - machine scale set deallocates. + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] - :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. - (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is - None. - :paramtype hibernate: bool + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -1401,31 +1053,25 @@ async def begin_deallocate( """ @distributed_trace_async - async def begin_deallocate( + async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - *, - hibernate: Optional[bool] = None, + availability_set_name: str, + parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, IO[bytes]]] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and - releases the compute resources. You are not billed for the compute resources that this virtual - machine scale set deallocates. + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. - (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is - None. - :paramtype hibernate: bool + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is + either a ConvertToVirtualMachineScaleSetInput type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ConvertToVirtualMachineScaleSetInput + or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1440,11 +1086,10 @@ async def begin_deallocate( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._deallocate_initial( + raw_result = await self._convert_to_virtual_machine_scale_set_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - hibernate=hibernate, + availability_set_name=availability_set_name, + parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1460,7 +1105,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1474,15 +1121,91 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_instances_initial( + @overload + async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], + availability_set_name: str, + parameters: _models.MigrateToVirtualMachineScaleSetInput, *, - force_deletion: Optional[bool] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterator[bytes]: + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, IO[bytes]], + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is + either a MigrateToVirtualMachineScaleSetInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput + or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1496,21 +1219,20 @@ async def _delete_instances_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceRequiredIDs") + _json = self._serialize.body(parameters, "MigrateToVirtualMachineScaleSetInput") - _request = build_virtual_machine_scale_sets_delete_instances_request( + _request = build_availability_sets_start_migration_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, - force_deletion=force_deletion, api_version=api_version, content_type=content_type, json=_json, @@ -1520,175 +1242,100 @@ async def _delete_instances_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @overload - async def begin_delete_instances( + async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + availability_set_name: str, + parameters: _models.MigrateToVirtualMachineScaleSetInput, *, - force_deletion: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes virtual machines in a VM scale set. + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Required. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs - :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale - set. (Feature in Preview). Default value is None. - :paramtype force_deletion: bool + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_delete_instances( + async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: IO[bytes], + availability_set_name: str, + parameters: IO[bytes], *, - force_deletion: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes virtual machines in a VM scale set. + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Required. - :type vm_instance_i_ds: IO[bytes] - :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale - set. (Feature in Preview). Default value is None. - :paramtype force_deletion: bool + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_delete_instances( + async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - *, - force_deletion: Optional[bool] = None, + availability_set_name: str, + parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes virtual machines in a VM scale set. + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceRequiredIDs type or a IO[bytes] type. Required. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs or IO[bytes] - :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale - set. (Feature in Preview). Default value is None. - :paramtype force_deletion: bool - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_instances_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - force_deletion=force_deletion, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get_instance_view( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> _models.VirtualMachineScaleSetInstanceView: - """Gets the status of a VM scale set instance. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: VirtualMachineScaleSetInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetInstanceView + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is + either a MigrateToVirtualMachineScaleSetInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput + or IO[bytes] + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1699,17 +1346,29 @@ async def get_instance_view( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetInstanceView] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_get_instance_view_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrateToVirtualMachineScaleSetInput") + + _request = build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -1722,34 +1381,35 @@ async def get_instance_view( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineScaleSetInstanceView", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineScaleSet"]: - """Gets a list of all VM scale sets under a resource group. + def list_available_sizes( + self, resource_group_name: str, availability_set_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineSize"]: + """Lists all available virtual machine sizes that can be used to create a new virtual machine in + an existing availability set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either VirtualMachineScaleSet or the result of - cls(response) + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1762,8 +1422,9 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_scale_sets_list_request( + _request = build_availability_sets_list_available_sizes_request( resource_group_name=resource_group_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -1789,7 +1450,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1812,23 +1473,64 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + +class CapacityReservationGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`capacity_reservation_groups` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace - def list_all(self, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineScaleSet"]: - """Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource - group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this - till nextLink is null to fetch all the VM Scale Sets. + def list_by_subscription( + self, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.CapacityReservationGroup"]: + """Lists all of the capacity reservation groups in the subscription. Use the nextLink property in + the response to get the next page of capacity reservation groups. - :return: An iterator like instance of either VirtualMachineScaleSet or the result of + :keyword expand: The expand expression to apply on the operation. Based on the expand param(s) + specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are + associated to capacity reservation group in the response. Known values are: + "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. + :paramtype expand: str or + ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForGetCapacityReservationGroups + :keyword resource_ids_only: The query option to fetch Capacity Reservation Group Resource Ids. + :code:`
    ` 'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation + group resources created in the subscription. :code:`
    ` 'SharedWithSubscription' enables + fetching Resource Ids for all capacity reservation group resources shared with the + subscription. :code:`
    ` 'All' enables fetching Resource Ids for all capacity reservation + group resources shared with the subscription and created in the subscription. Known values are: + "CreatedInSubscription", "SharedWithSubscription", and "All". Default value is None. + :paramtype resource_ids_only: str or + ~azure.mgmt.compute.v2024_11_01.models.ResourceIdOptionsForGetCapacityReservationGroups + :return: An iterator like instance of either CapacityReservationGroup or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetListWithLinkResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationGroupListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1841,8 +1543,10 @@ def list_all(self, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineScaleS def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_scale_sets_list_all_request( + _request = build_capacity_reservation_groups_list_by_subscription_request( subscription_id=self._config.subscription_id, + expand=expand, + resource_ids_only=resource_ids_only, api_version=api_version, headers=_headers, params=_params, @@ -1867,7 +1571,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) + deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1891,27 +1595,36 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_skus( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterable["_models.VirtualMachineScaleSetSku"]: - """Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM - instances allowed for each SKU. + def list_by_resource_group( + self, + resource_group_name: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.CapacityReservationGroup"]: + """Lists all of the capacity reservation groups in the specified resource group. Use the nextLink + property in the response to get the next page of capacity reservation groups. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An iterator like instance of either VirtualMachineScaleSetSku or the result of + :keyword expand: The expand expression to apply on the operation. Based on the expand param(s) + specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are + associated to capacity reservation group in the response. Known values are: + "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. + :paramtype expand: str or + ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForGetCapacityReservationGroups + :return: An iterator like instance of either CapacityReservationGroup or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetSku] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetListSkusResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationGroupListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1924,10 +1637,10 @@ def list_skus( def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_scale_sets_list_skus_request( + _request = build_capacity_reservation_groups_list_by_resource_group_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -1952,7 +1665,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) + deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1975,29 +1688,33 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def get_os_upgrade_history( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterable["_models.UpgradeOperationHistoricalStatusInfo"]: - # pylint: disable=line-too-long - """Gets list of OS upgrades on a VM scale set instance. + @distributed_trace_async + async def get( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + *, + expand: Optional[Union[str, _models.CapacityReservationGroupInstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation that retrieves information about a capacity reservation group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An iterator like instance of either UpgradeOperationHistoricalStatusInfo or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.UpgradeOperationHistoricalStatusInfo] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve + the list of instance views of the capacity reservations under the capacity reservation group + which is a snapshot of the runtime properties of a capacity reservation that is managed by the + platform and can change outside of control plane operations. "instanceView" Default value is + None. + :paramtype expand: str or + ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroupInstanceViewTypes + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetListOSUpgradeHistory] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2006,126 +1723,35 @@ def get_os_upgrade_history( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_virtual_machine_scale_sets_get_os_upgrade_history_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _power_off_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - *, - skip_shutdown: bool = False, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None - - _request = build_virtual_machine_scale_sets_power_off_request( + _request = build_capacity_reservation_groups_get_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, + expand=expand, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2133,158 +1759,87 @@ async def _power_off_initial( return deserialized # type: ignore @overload - async def begin_power_off( + async def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + capacity_reservation_group_name: str, + parameters: _models.CapacityReservationGroup, *, - skip_shutdown: bool = False, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still - attached and you are getting charged for the resources. Instead, use deallocate to release - resources and avoid charges. Additionally, this operation is not allowed on virtual machines in - a VM scale set that are being deallocated or have already been deallocated. + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs - :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this - flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. Default value is False. - :paramtype skip_shutdown: bool + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_power_off( + async def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, + capacity_reservation_group_name: str, + parameters: IO[bytes], *, - skip_shutdown: bool = False, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still - attached and you are getting charged for the resources. Instead, use deallocate to release - resources and avoid charges. Additionally, this operation is not allowed on virtual machines in - a VM scale set that are being deallocated or have already been deallocated. + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] - :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this - flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. Default value is False. - :paramtype skip_shutdown: bool + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_power_off( + async def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - *, - skip_shutdown: bool = False, + capacity_reservation_group_name: str, + parameters: Union[_models.CapacityReservationGroup, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still - attached and you are getting charged for the resources. Instead, use deallocate to release - resources and avoid charges. Additionally, this operation is not allowed on virtual machines in - a VM scale set that are being deallocated or have already been deallocated. + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this - flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. Default value is False. - :paramtype skip_shutdown: bool - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Is either a + CapacityReservationGroup type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup or IO[bytes] + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._power_off_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - skip_shutdown=skip_shutdown, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _restart_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2298,22 +1853,19 @@ async def _restart_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None + _json = self._serialize.body(parameters, "CapacityReservationGroup") - _request = build_virtual_machine_scale_sets_restart_request( + _request = build_capacity_reservation_groups_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -2324,23 +1876,18 @@ async def _restart_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2348,132 +1895,87 @@ async def _restart_initial( return deserialized # type: ignore @overload - async def begin_restart( + async def update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + capacity_reservation_group_name: str, + parameters: _models.CapacityReservationGroupUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restarts one or more virtual machines in a VM scale set. + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_restart( + async def update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, + capacity_reservation_group_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restarts one or more virtual machines in a VM scale set. + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_restart( + async def update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + capacity_reservation_group_name: str, + parameters: Union[_models.CapacityReservationGroupUpdate, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restarts one or more virtual machines in a VM scale set. + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. Is + either a CapacityReservationGroupUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroupUpdate or + IO[bytes] + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2487,22 +1989,19 @@ async def _start_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None + _json = self._serialize.body(parameters, "CapacityReservationGroupUpdate") - _request = build_virtual_machine_scale_sets_start_request( + _request = build_capacity_reservation_groups_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -2513,169 +2012,57 @@ async def _start_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_start( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Starts one or more virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_start( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Starts one or more virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_start( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Starts one or more virtual machines in a VM scale set. + async def delete(self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any) -> None: + """The operation to delete a capacity reservation group. This operation is allowed only if all the + associated resources are disassociated from the reservation group and all capacity reservations + under the reservation group have also been deleted. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reapply_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_reapply_request( + _request = build_capacity_reservation_groups_delete_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -2683,97 +2070,57 @@ async def _reapply_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: + return cls(pipeline_response, None, {}) # type: ignore - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore +class DedicatedHostGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - return deserialized # type: ignore + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`dedicated_host_groups` attribute. + """ - @distributed_trace_async - async def begin_reapply( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine - Instances. + models = _models - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DedicatedHostGroup"]: + """Lists all of the dedicated host groups in the subscription. Use the nextLink property in the + response to get the next page of dedicated host groups. + + :return: An iterator like instance of either DedicatedHostGroup or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._reapply_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + cls: ClsType[_models.DedicatedHostGroupListResult] = kwargs.pop("cls", None) - async def _redeploy_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2782,190 +2129,165 @@ async def _redeploy_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + _request = build_dedicated_host_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") else: - _json = None - - _request = build_virtual_machine_scale_sets_redeploy_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) - @overload - async def begin_redeploy( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, - and powers them back on. + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DedicatedHostGroup"]: + """Lists all of the dedicated host groups in the specified resource group. Use the nextLink + property in the response to get the next page of dedicated host groups. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An iterator like instance of either DedicatedHostGroup or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @overload - async def begin_redeploy( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, - and powers them back on. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.DedicatedHostGroupListResult] = kwargs.pop("cls", None) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace_async - async def begin_redeploy( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, - and powers them back on. + def prepare_request(next_link=None): + if not next_link: - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _request = build_dedicated_host_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._redeploy_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + async def extract_data(pipeline_response): + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response - async def _perform_maintenance_initial( + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + host_group_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: + ) -> _models.DedicatedHostGroup: + """Retrieves information about a dedicated host group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve + the list of instance views of the dedicated hosts under the dedicated host group. 'UserData' is + not supported for dedicated host group. Known values are: "instanceView", "userData", and + "resiliencyView". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2974,54 +2296,35 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_perform_maintenance_request( + _request = build_dedicated_host_groups_get_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3029,141 +2332,87 @@ async def _perform_maintenance_initial( return deserialized # type: ignore @overload - async def begin_perform_maintenance( + async def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + host_group_name: str, + parameters: _models.DedicatedHostGroup, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances - which are not eligible for perform maintenance will be failed. Please refer to best practices - for more details: - https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + ) -> _models.DedicatedHostGroup: + """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host + Groups please see [Dedicated Host Documentation] + (https://go.microsoft.com/fwlink/?linkid=2082596). - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_perform_maintenance( + async def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, + host_group_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances - which are not eligible for perform maintenance will be failed. Please refer to best practices - for more details: - https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + ) -> _models.DedicatedHostGroup: + """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host + Groups please see [Dedicated Host Documentation] + (https://go.microsoft.com/fwlink/?linkid=2082596). - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_perform_maintenance( + async def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + host_group_name: str, + parameters: Union[_models.DedicatedHostGroup, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances - which are not eligible for perform maintenance will be failed. Please refer to best practices - for more details: - https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + ) -> _models.DedicatedHostGroup: + """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host + Groups please see [Dedicated Host Documentation] + (https://go.microsoft.com/fwlink/?linkid=2082596). - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Is either a + DedicatedHostGroup type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup or IO[bytes] + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._perform_maintenance_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_instances_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3177,19 +2426,19 @@ async def _update_instances_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceRequiredIDs") + _json = self._serialize.body(parameters, "DedicatedHostGroup") - _request = build_virtual_machine_scale_sets_update_instances_request( + _request = build_dedicated_host_groups_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -3200,23 +2449,18 @@ async def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -3224,132 +2468,81 @@ async def _update_instances_initial( return deserialized # type: ignore @overload - async def begin_update_instances( + async def update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + host_group_name: str, + parameters: _models.DedicatedHostGroupUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_instances( + async def update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: IO[bytes], + host_group_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_instance_i_ds: IO[bytes] + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_instances( + async def update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], + host_group_name: str, + parameters: Union[_models.DedicatedHostGroupUpdate, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceRequiredIDs type or a IO[bytes] type. Required. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Is either + a DedicatedHostGroupUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroupUpdate or IO[bytes] + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_instances_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reimage_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[Union[_models.VirtualMachineScaleSetReimageParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3363,22 +2556,19 @@ async def _reimage_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_scale_set_reimage_input, (IOBase, bytes)): - _content = vm_scale_set_reimage_input + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_scale_set_reimage_input is not None: - _json = self._serialize.body(vm_scale_set_reimage_input, "VirtualMachineScaleSetReimageParameters") - else: - _json = None + _json = self._serialize.body(parameters, "DedicatedHostGroupUpdate") - _request = build_virtual_machine_scale_sets_reimage_request( + _request = build_dedicated_host_groups_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -3389,160 +2579,37 @@ async def _reimage_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[_models.VirtualMachineScaleSetReimageParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which - don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual - machine is reset to initial state. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. - :type vm_scale_set_reimage_input: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetReimageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which - don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual - machine is reset to initial state. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. - :type vm_scale_set_reimage_input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[Union[_models.VirtualMachineScaleSetReimageParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which - don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual - machine is reset to initial state. + async def delete(self, resource_group_name: str, host_group_name: str, **kwargs: Any) -> None: + """Delete a dedicated host group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Is either a - VirtualMachineScaleSetReimageParameters type or a IO[bytes] type. Default value is None. - :type vm_scale_set_reimage_input: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetReimageParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._reimage_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_scale_set_reimage_input=vm_scale_set_reimage_input, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reimage_all_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3551,189 +2618,273 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_reimage_all_request( + _request = build_dedicated_host_groups_delete_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - return deserialized # type: ignore - @overload - async def begin_reimage_all( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This - operation is only supported for managed disks. +class ImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`images` attribute. + """ - @overload - async def begin_reimage_all( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This - operation is only supported for managed disks. + models = _models - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Image"]: + """Gets the list of Images in the subscription. Use nextLink property in the response to get the + next page of Images. Do this till nextLink is null to fetch all the Images. + + :return: An iterator like instance of either Image or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @distributed_trace_async - async def begin_reimage_all( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This - operation is only supported for managed disks. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.ImageListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_images_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ImageListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) - :param resource_group_name: The name of the resource group. Required. + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Image"]: + """Gets the list of images under a resource group. Use nextLink property in the response to get + the next page of Images. Do this till nextLink is null to fetch all the Images. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An iterator like instance of either Image or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._reimage_all_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.ImageListResult] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_images_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ImageListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response - async def _approve_rolling_upgrade_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, image_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.Image: + """Gets an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: Image or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.Image + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + + _request = build_images_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Image", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, resource_group_name: str, image_name: str, parameters: Union[_models.Image, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3753,17 +2904,14 @@ async def _approve_rolling_upgrade_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None + _json = self._serialize.body(parameters, "Image") - _request = build_virtual_machine_scale_sets_approve_rolling_upgrade_request( + _request = build_images_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + image_name=image_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -3782,7 +2930,7 @@ async def _approve_rolling_upgrade_initial( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -3791,7 +2939,9 @@ async def _approve_rolling_upgrade_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -3801,83 +2951,75 @@ async def _approve_rolling_upgrade_initial( return deserialized # type: ignore @overload - async def begin_approve_rolling_upgrade( + async def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + image_name: str, + parameters: _models.Image, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale - set. + ) -> AsyncLROPoller[_models.Image]: + """Create or update an image. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.Image :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_approve_rolling_upgrade( + async def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, + image_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale - set. + ) -> AsyncLROPoller[_models.Image]: + """Create or update an image. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_approve_rolling_upgrade( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale - set. + async def begin_create_or_update( + self, resource_group_name: str, image_name: str, parameters: Union[_models.Image, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.Image]: + """Create or update an image. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Is either a Image type or + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.Image or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3885,15 +3027,15 @@ async def begin_approve_rolling_upgrade( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Image] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._approve_rolling_upgrade_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, + image_name=image_name, + parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3904,56 +3046,38 @@ async def begin_approve_rolling_upgrade( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Image", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.Image].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.Image]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - @distributed_trace_async - async def force_recovery_service_fabric_platform_update_domain_walk( # pylint: disable=name-too-long + async def _update_initial( self, resource_group_name: str, - vm_scale_set_name: str, - *, - platform_update_domain: int, - zone: Optional[str] = None, - placement_group_id: Optional[str] = None, + image_name: str, + parameters: Union[_models.ImageUpdate, IO[bytes]], **kwargs: Any - ) -> _models.RecoveryWalkResponse: - """Manual platform update domain walk to update virtual machines in a service fabric virtual - machine scale set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :keyword platform_update_domain: The platform update domain for which a manual recovery walk is - requested. Required. - :paramtype platform_update_domain: int - :keyword zone: The zone in which the manual recovery walk is requested for cross zone virtual - machine scale set. Default value is None. - :paramtype zone: str - :keyword placement_group_id: The placement group id for which the manual recovery walk is - requested. Default value is None. - :paramtype placement_group_id: str - :return: RecoveryWalkResponse or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RecoveryWalkResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3962,179 +3086,188 @@ async def force_recovery_service_fabric_platform_update_domain_walk( # pylint: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RecoveryWalkResponse] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ImageUpdate") + + _request = build_images_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + image_name=image_name, subscription_id=self._config.subscription_id, - platform_update_domain=platform_update_domain, - zone=zone, - placement_group_id=placement_group_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecoveryWalkResponse", pipeline_response.http_response) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def convert_to_single_placement_group( + async def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VMScaleSetConvertToSinglePlacementGroupInput, + image_name: str, + parameters: _models.ImageUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + ) -> AsyncLROPoller[_models.Image]: + """Update an image. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. - :type parameters: - ~azure.mgmt.compute.v2024_11_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ImageUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def convert_to_single_placement_group( + async def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, + image_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + ) -> AsyncLROPoller[_models.Image]: + """Update an image. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def convert_to_single_placement_group( + async def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VMScaleSetConvertToSinglePlacementGroupInput, IO[bytes]], + image_name: str, + parameters: Union[_models.ImageUpdate, IO[bytes]], **kwargs: Any - ) -> None: - """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + ) -> AsyncLROPoller[_models.Image]: + """Update an image. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ConvertToSinglePlacementGroup API. Is either a - VMScaleSetConvertToSinglePlacementGroupInput type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.compute.v2024_11_01.models.VMScaleSetConvertToSinglePlacementGroupInput or - IO[bytes] - :return: None or the result of cls(response) - :rtype: None + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Is either a ImageUpdate + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ImageUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VMScaleSetConvertToSinglePlacementGroupInput") + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - _request = build_virtual_machine_scale_sets_convert_to_single_placement_group_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Image", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Image].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Image]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - async def _set_orchestration_service_state_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.OrchestrationServiceStateInput, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: + async def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4143,29 +3276,17 @@ async def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "OrchestrationServiceStateInput") - - _request = build_virtual_machine_scale_sets_set_orchestration_service_state_request( + _request = build_images_delete_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + image_name=image_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -4179,7 +3300,7 @@ async def _set_orchestration_service_state_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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): @@ -4187,106 +3308,44 @@ async def _set_orchestration_service_state_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def begin_set_orchestration_service_state( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.OrchestrationServiceStateInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Changes ServiceState property for a given service. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the virtual machine scale set to create or update. - Required. - :type vm_scale_set_name: str - :param parameters: The input object for SetOrchestrationServiceState API. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.OrchestrationServiceStateInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_orchestration_service_state( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Changes ServiceState property for a given service. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the virtual machine scale set to create or update. - Required. - :type vm_scale_set_name: str - :param parameters: The input object for SetOrchestrationServiceState API. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_set_orchestration_service_state( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.OrchestrationServiceStateInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Changes ServiceState property for a given service. + async def begin_delete(self, resource_group_name: str, image_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes an Image. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_scale_set_name: str - :param parameters: The input object for SetOrchestrationServiceState API. Is either a - OrchestrationServiceStateInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.OrchestrationServiceStateInput or - IO[bytes] + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._set_orchestration_service_state_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - parameters=parameters, + image_name=image_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -4300,7 +3359,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -4315,34 +3376,40 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore -class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-long +class VirtualMachineImagesEdgeZoneOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_extensions` attribute. + :attr:`virtual_machine_images_edge_zone` attribute. """ models = _models def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - async def _create_or_update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtension, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: + @distributed_trace_async + async def list_publishers( + self, location: str, edge_zone: str, **kwargs: Any + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + + :param location: The name of Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4351,209 +3418,119 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetExtension") + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_extensions_create_or_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, + _request = build_virtual_machine_images_edge_zone_list_publishers_request( + location=location, + edge_zone=edge_zone, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to create or update an extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be create or - updated. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Create VM scale set Extension - operation. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to create or update an extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be create or - updated. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Create VM scale set Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtension, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to create or update an extension. + async def list_offers( + self, location: str, edge_zone: str, publisher_name: str, **kwargs: Any + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of virtual machine image offers for the specified location, edge zone and + publisher. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be create or - updated. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Create VM scale set Extension - operation. Is either a VirtualMachineScaleSetExtension type or a IO[bytes] type. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] + :param location: The name of Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + _request = build_virtual_machine_images_edge_zone_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineScaleSetExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - async def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_skus( + self, location: str, edge_zone: str, publisher_name: str, offer: str, **kwargs: Any + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and + offer. + + :param location: The name of Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4562,205 +3539,81 @@ async def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetExtensionUpdate") + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_extensions_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, + _request = build_virtual_machine_images_edge_zone_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_update( + @distributed_trace_async + async def list( self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetExtensionUpdate, + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, *, - content_type: str = "application/json", + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to update an extension. + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of all virtual machine image versions for the specified location, edge zone, + publisher, offer, and SKU. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be updated. - Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Update VM scale set Extension - operation. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to update an extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be updated. - Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Update VM scale set Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to update an extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be updated. - Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Update VM scale set Extension - operation. Is either a VirtualMachineScaleSetExtensionUpdate type or a IO[bytes] type. - Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtensionUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] + :param location: The name of Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :keyword top: An integer value specifying the number of images to return that matches supplied + values. Default value is None. + :paramtype top: int + :keyword orderby: Specifies the order of the results returned. Formatted as an OData query. + Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.VirtualMachineScaleSetExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4773,122 +3626,62 @@ async def _delete_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_extensions_delete_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, + _request = build_virtual_machine_images_edge_zone_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to delete the extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be deleted. - Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace_async async def get( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - *, - expand: Optional[str] = None, - **kwargs: Any - ) -> _models.VirtualMachineScaleSetExtension: - """The operation to get the extension. + self, location: str, edge_zone: str, publisher_name: str, offer: str, skus: str, version: str, **kwargs: Any + ) -> _models.VirtualMachineImage: + """Gets a virtual machine image in an edge zone. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set containing the extension. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension + :param location: The name of Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :param version: A valid image SKU version. Required. + :type version: str + :return: VirtualMachineImage or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4903,14 +3696,16 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_extensions_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, + _request = build_virtual_machine_images_edge_zone_get_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -4928,121 +3723,48 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineImage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterable["_models.VirtualMachineScaleSetExtension"]: - """Gets a list of all extensions in a VM scale set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set containing the extension. Required. - :type vm_scale_set_name: str - :return: An iterator like instance of either VirtualMachineScaleSetExtension or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetExtensionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machine_scale_set_extensions_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - -class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-too-long +class VirtualMachineImagesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_rolling_upgrades` attribute. + :attr:`virtual_machine_images` attribute. """ models = _models def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - async def _cancel_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: + @distributed_trace_async + async def list_by_edge_zone( + self, location: str, edge_zone: str, **kwargs: Any + ) -> _models.VmImagesInEdgeZoneListResult: + """Gets a list of all virtual machine image versions for the specified edge zone. + + :param location: The name of Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :return: VmImagesInEdgeZoneListResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VmImagesInEdgeZoneListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5055,11 +3777,11 @@ async def _cancel_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.VmImagesInEdgeZoneListResult] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_rolling_upgrades_cancel_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + _request = build_virtual_machine_images_list_by_edge_zone_request( + location=location, + edge_zone=edge_zone, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -5067,23 +3789,18 @@ async def _cancel_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("VmImagesInEdgeZoneListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5091,62 +3808,15 @@ async def _cancel_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_cancel( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Cancels the current virtual machine scale set rolling upgrade. + async def list_publishers(self, location: str, **kwargs: Any) -> List[_models.VirtualMachineImageResource]: + """Gets a list of virtual machine image publishers for the specified Azure location. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param location: The name of Azure region. Required. + :type location: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._cancel_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_os_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5159,11 +3829,10 @@ async def _start_os_upgrade_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + _request = build_virtual_machine_images_list_publishers_request( + location=location, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -5171,23 +3840,18 @@ async def _start_os_upgrade_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5195,64 +3859,77 @@ async def _start_os_upgrade_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_start_os_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Starts a rolling upgrade to move all virtual machine scale set instances to the latest - available Platform Image OS version. Instances which are already running the latest available - OS version are not affected. + async def list_offers( + self, location: str, publisher_name: str, **kwargs: Any + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of virtual machine image offers for the specified location and publisher. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_os_upgrade_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + _request = build_virtual_machine_images_list_offers_request( + location=location, + publisher_name=publisher_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def _start_extension_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_skus( + self, location: str, publisher_name: str, offer: str, **kwargs: Any + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5265,11 +3942,12 @@ async def _start_extension_upgrade_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + _request = build_virtual_machine_images_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -5277,23 +3955,18 @@ async def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -5301,73 +3974,37 @@ async def _start_extension_upgrade_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_start_extension_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to - the latest available extension version. Instances which are already running the latest - extension versions are not affected. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_extension_upgrade_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get_latest( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> _models.RollingUpgradeStatusInfo: - """Gets the status of the latest virtual machine scale set rolling upgrade. + async def list( + self, + location: str, + publisher_name: str, + offer: str, + skus: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of all virtual machine image versions for the specified location, publisher, offer, + and SKU. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: RollingUpgradeStatusInfo or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RollingUpgradeStatusInfo + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5382,12 +4019,17 @@ async def get_latest( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RollingUpgradeStatusInfo] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + _request = build_virtual_machine_images_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, api_version=api_version, headers=_headers, params=_params, @@ -5405,43 +4047,33 @@ async def get_latest( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RollingUpgradeStatusInfo", pipeline_response.http_response) + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @distributed_trace_async + async def get( + self, location: str, publisher_name: str, offer: str, skus: str, version: str, **kwargs: Any + ) -> _models.VirtualMachineImage: + """Gets a virtual machine image. -class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_vm_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - async def _create_or_update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :param version: A valid image SKU version. Required. + :type version: str + :return: VirtualMachineImage or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5450,217 +4082,173 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetVMExtension") + cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_extensions_create_or_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, + _request = build_virtual_machine_images_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("VirtualMachineImage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_create_or_update( + @distributed_trace + def list_with_properties( self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetVMExtension, + location: str, + publisher_name: str, + offer: str, + skus: str, *, - content_type: str = "application/json", + expand: Union[str, _models.Expand], + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to create or update the VMSS VM extension. + ) -> AsyncIterable["_models.VirtualMachineImage"]: + """list_with_properties. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or - the result of cls(response) + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. "Properties" Required. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.Expand + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: An iterator like instance of either VirtualMachineImage or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to create or update the VMSS VM extension. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineImagesWithPropertiesListResult] = kwargs.pop("cls", None) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to create or update the VMSS VM extension. + def prepare_request(next_link=None): + if not next_link: - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Is either a VirtualMachineScaleSetVMExtension type or a IO[bytes] type. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _request = build_virtual_machine_images_list_with_properties_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineImagesWithPropertiesListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + response = pipeline_response.http_response - async def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, IO[bytes]], - **kwargs: Any + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class LogAnalyticsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`log_analytics` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _export_request_rate_by_interval_initial( + self, location: str, parameters: Union[_models.RequestRateByIntervalInput, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5680,17 +4268,14 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetVMExtensionUpdate") + _json = self._serialize.body(parameters, "RequestRateByIntervalInput") - _request = build_virtual_machine_scale_set_vm_extensions_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, - subscription_id=self._config.subscription_id, + _request = build_log_analytics_export_request_rate_by_interval_request( + location=location, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -5708,7 +4293,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -5716,113 +4301,86 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_update( + async def begin_export_request_rate_by_interval( self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetVMExtensionUpdate, + location: str, + parameters: _models.RequestRateByIntervalInput, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to update the VMSS VM extension. + ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtensionUpdate + :param location: The name of Azure region. Required. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RequestRateByIntervalInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or - the result of cls(response) + :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to update the VMSS VM extension. + async def begin_export_request_rate_by_interval( + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] + :param location: The name of Azure region. Required. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or - the result of cls(response) + :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to update the VMSS VM extension. + async def begin_export_request_rate_by_interval( + self, location: str, parameters: Union[_models.RequestRateByIntervalInput, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Is either a VirtualMachineScaleSetVMExtensionUpdate type or a IO[bytes] type. - Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtensionUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or - the result of cls(response) + :param location: The name of Azure region. Required. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is + either a RequestRateByIntervalInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RequestRateByIntervalInput or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the + result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -5830,17 +4388,14 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) + cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, - extension_parameters=extension_parameters, + raw_result = await self._export_request_rate_by_interval_initial( + location=location, + parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -5852,30 +4407,33 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) + deserialized = self._deserialize("LogAnalyticsOperationResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( + return AsyncLROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]( + return AsyncLROPoller[_models.LogAnalyticsOperationResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any + async def _export_throttled_requests_initial( + self, location: str, parameters: Union[_models.ThrottledRequestsInput, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5885,19 +4443,28 @@ async def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_extensions_delete_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ThrottledRequestsInput") + + _request = build_log_analytics_export_throttled_requests_request( + location=location, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -5911,7 +4478,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -5919,46 +4486,100 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + async def begin_export_throttled_requests( + self, + location: str, + parameters: _models.ThrottledRequestsInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The name of Azure region. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ThrottledRequestsInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_export_throttled_requests( + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The name of Azure region. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to delete the VMSS VM extension. + async def begin_export_throttled_requests( + self, location: str, parameters: Union[_models.ThrottledRequestsInput, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param location: The name of Azure region. Required. + :type location: str + :param parameters: The request body. Is either a ThrottledRequestsInput type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ThrottledRequestsInput or IO[bytes] + :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, + raw_result = await self._export_throttled_requests_initial( + location=location, + parameters=parameters, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -5967,50 +4588,65 @@ async def begin_delete( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LogAnalyticsOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.LogAnalyticsOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class VirtualMachineExtensionImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`virtual_machine_extension_images` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async - async def get( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - *, - expand: Optional[str] = None, - **kwargs: Any - ) -> _models.VirtualMachineScaleSetVMExtension: - """The operation to get the VMSS VM extension. + async def list_types( + self, location: str, publisher_name: str, **kwargs: Any + ) -> List[_models.VirtualMachineExtensionImage]: + """Gets a list of virtual machine extension image types. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :return: list of VirtualMachineExtensionImage or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionImage] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6025,15 +4661,12 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_extensions_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, + _request = build_virtual_machine_extension_images_list_types_request( + location=location, + publisher_name=publisher_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -6051,7 +4684,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) + deserialized = self._deserialize("[VirtualMachineExtensionImage]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6059,27 +4692,33 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def list( + async def list_versions( self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, + location: str, + publisher_name: str, + type: str, *, - expand: Optional[str] = None, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any - ) -> _models.VirtualMachineScaleSetVMExtensionsListResult: - """The operation to get all extensions of an instance in Virtual Machine Scaleset. + ) -> List[_models.VirtualMachineExtensionImage]: + """Gets a list of virtual machine extension image versions. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineScaleSetVMExtensionsListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtensionsListResult + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :param type: Required. + :type type: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineExtensionImage or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionImage] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6094,14 +4733,16 @@ async def list( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMExtensionsListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_extensions_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + _request = build_virtual_machine_extension_images_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, subscription_id=self._config.subscription_id, - expand=expand, + filter=filter, + top=top, + orderby=orderby, api_version=api_version, headers=_headers, params=_params, @@ -6119,46 +4760,31 @@ async def list( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize( - "VirtualMachineScaleSetVMExtensionsListResult", pipeline_response.http_response - ) + deserialized = self._deserialize("[VirtualMachineExtensionImage]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @distributed_trace_async + async def get( + self, location: str, publisher_name: str, type: str, version: str, **kwargs: Any + ) -> _models.VirtualMachineExtensionImage: + """Gets a virtual machine extension image. -class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_vms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - async def _reimage_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[ - Union[_models.VirtualMachineScaleSetVMReimageParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :param type: Required. + :type type: str + :param version: Required. + :type version: str + :return: VirtualMachineExtensionImage or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionImage + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6167,197 +4793,154 @@ async def _reimage_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_scale_set_vm_reimage_input, (IOBase, bytes)): - _content = vm_scale_set_vm_reimage_input - else: - if vm_scale_set_vm_reimage_input is not None: - _json = self._serialize.body(vm_scale_set_vm_reimage_input, "VirtualMachineScaleSetVMReimageParameters") - else: - _json = None + cls: ClsType[_models.VirtualMachineExtensionImage] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_reimage_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + _request = build_virtual_machine_extension_images_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("VirtualMachineExtensionImage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[_models.VirtualMachineScaleSetVMReimageParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. - Default value is None. - :type vm_scale_set_vm_reimage_input: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMReimageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ +class VirtualMachineRunCommandsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - @overload - async def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`virtual_machine_run_commands` attribute. + """ - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. - Default value is None. - :type vm_scale_set_vm_reimage_input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + models = _models - @distributed_trace_async - async def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[ - Union[_models.VirtualMachineScaleSetVMReimageParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. - Is either a VirtualMachineScaleSetVMReimageParameters type or a IO[bytes] type. Default value - is None. - :type vm_scale_set_vm_reimage_input: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMReimageParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.RunCommandDocumentBase"]: + """Lists all available run commands for a subscription in a location. + + :param location: The name of Azure region. Required. + :type location: str + :return: An iterator like instance of either RunCommandDocumentBase or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.RunCommandDocumentBase] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._reimage_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.RunCommandListResult] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_run_commands_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RunCommandListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response - async def _reimage_all_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, location: str, command_id: str, **kwargs: Any) -> _models.RunCommandDocument: + """Gets specific run command for a subscription in a location. + + :param location: The name of Azure region. Required. + :type location: str + :param command_id: The command id. Required. + :type command_id: str + :return: RunCommandDocument or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RunCommandDocument + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6370,12 +4953,11 @@ async def _reimage_all_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.RunCommandDocument] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_reimage_all_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + _request = build_virtual_machine_run_commands_get_request( + location=location, + command_id=command_id, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -6383,90 +4965,49 @@ async def _reimage_all_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("RunCommandDocument", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_reimage_all( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. - This operation is only supported for managed disks. + @distributed_trace + def list_by_virtual_machine( + self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineRunCommand"]: + """The operation to get all run commands of a Virtual Machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of either VirtualMachineRunCommand or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._reimage_all_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + cls: ClsType[_models.VirtualMachineRunCommandsListResult] = kwargs.pop("cls", None) - async def _approve_rolling_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6475,109 +5016,86 @@ async def _approve_rolling_upgrade_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + _request = build_virtual_machine_run_commands_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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=_stream, **kwargs - ) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - if response.status_code not in [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + async def get_next(next_link=None): + _request = prepare_request(next_link) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def begin_approve_rolling_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. + async def get_by_virtual_machine( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.VirtualMachineRunCommand: + """The operation to get the run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineRunCommand or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._approve_rolling_upgrade_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _deallocate_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6590,110 +5108,44 @@ async def _deallocate_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_deallocate_request( + _request = build_virtual_machine_run_commands_get_by_virtual_machine_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_deallocate( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and - releases the compute resources it uses. You are not billed for the compute resources of this - virtual machine once it is deallocated. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._deallocate_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( + async def _create_or_update_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.VirtualMachineScaleSetVM, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -6714,18 +5166,16 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - _json = self._serialize.body(parameters, "VirtualMachineScaleSetVM") + _json = self._serialize.body(run_command, "VirtualMachineRunCommand") - _request = build_virtual_machine_scale_set_vms_update_request( + _request = build_virtual_machine_run_commands_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, api_version=api_version, content_type=content_type, json=_json, @@ -6743,7 +5193,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -6751,135 +5201,109 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: _models.VirtualMachineScaleSetVM, + vm_name: str, + run_command_name: str, + run_command: _models.VirtualMachineRunCommand, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: - """Updates a virtual machine of a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be create or - updated. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the + :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: IO[bytes], + vm_name: str, + run_command_name: str, + run_command: IO[bytes], *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: - """Updates a virtual machine of a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be create or - updated. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. - :type parameters: IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the + :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.VirtualMachineScaleSetVM, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: - """Updates a virtual machine of a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be create or - updated. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Is either a VirtualMachineScaleSetVM type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM or IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is + either a VirtualMachineRunCommand type or a IO[bytes] type. Required. + :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand or IO[bytes] + :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -6887,18 +5311,16 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -6910,35 +5332,36 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetVM", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachineScaleSetVM].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineRunCommand].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachineScaleSetVM]( + return AsyncLROPoller[_models.VirtualMachineRunCommand]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( + async def _update_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - *, - force_deletion: Optional[bool] = None, + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -6949,19 +5372,30 @@ async def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(run_command, (IOBase, bytes)): + _content = run_command + else: + _json = self._serialize.body(run_command, "VirtualMachineRunCommandUpdate") + + _request = build_virtual_machine_run_commands_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, - force_deletion=force_deletion, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -6975,7 +5409,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -6983,108 +5417,169 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_delete( + @overload + async def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, + vm_name: str, + run_command_name: str, + run_command: _models.VirtualMachineRunCommandUpdate, *, - force_deletion: Optional[bool] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a virtual machine from a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword force_deletion: Optional parameter to force delete a virtual machine from a VM scale - set. (Feature in Preview). Default value is None. - :paramtype force_deletion: bool - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - force_deletion=force_deletion, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace_async - async def get( + @overload + async def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, + vm_name: str, + run_command_name: str, + run_command: IO[bytes], *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + content_type: str = "application/json", **kwargs: Any - ) -> _models.VirtualMachineScaleSetVM: - """Gets a virtual machine from a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve - the instance view of the virtual machine. 'UserData' will retrieve the UserData of the virtual - machine. 'resiliencyView' will retrieve the instance view of the Virtual machine (if - applicable) and include 'resilientVMDeletionStatus' as part of it. Known values are: - "instanceView", "userData", and "resiliencyView". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes - :return: VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is + either a VirtualMachineRunCommandUpdate type or a IO[bytes] type. Required. + :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandUpdate or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.VirtualMachineRunCommand].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VirtualMachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7097,135 +5592,144 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_get_request( + _request = build_virtual_machine_run_commands_delete_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineScaleSetVM", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def get_instance_view( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> _models.VirtualMachineScaleSetVMInstanceView: - """Gets the status of a virtual machine from a VM scale set. + async def begin_delete( + self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: VirtualMachineScaleSetVMInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceView + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMInstanceView] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - _request = build_virtual_machine_scale_set_vms_get_instance_view_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) +class UsageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - deserialized = self._deserialize("VirtualMachineScaleSetVMInstanceView", pipeline_response.http_response) + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`usage` attribute. + """ - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + models = _models - return deserialized # type: ignore + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list( - self, - resource_group_name: str, - virtual_machine_scale_set_name: str, - *, - filter: Optional[str] = None, - select: Optional[str] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.VirtualMachineScaleSetVM"]: - """Gets a list of all virtual machines in a VM scale sets. + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: + """Gets, for the specified location, the current compute resource usage information as well as the + limits for compute resources under the subscription. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_scale_set_name: The name of the VM scale set. Required. - :type virtual_machine_scale_set_name: str - :keyword filter: The filter to apply to the operation. Allowed values are - 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied - eq true', 'properties/latestModelApplied eq false'. Default value is None. - :paramtype filter: str - :keyword select: The list parameters. Allowed values are 'instanceView', - 'instanceView/statuses'. Default value is None. - :paramtype select: str - :keyword expand: The expand expression to apply to the operation. Allowed values are - 'instanceView'. Default value is None. - :paramtype expand: str - :return: An iterator like instance of either VirtualMachineScaleSetVM or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] + :param location: The name of Azure region. Required. + :type location: str + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.Usage] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7238,13 +5742,9 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_scale_set_vms_list_request( - resource_group_name=resource_group_name, - virtual_machine_scale_set_name=virtual_machine_scale_set_name, + _request = build_usage_list_request( + location=location, subscription_id=self._config.subscription_id, - filter=filter, - select=select, - expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -7269,7 +5769,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) + deserialized = self._deserialize("ListUsagesResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -7292,138 +5792,45 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _power_off_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - *, - skip_shutdown: bool = False, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vms_power_off_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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=_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) +class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`virtual_machine_scale_sets` attribute. + """ - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + models = _models - return deserialized # type: ignore + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - @distributed_trace_async - async def begin_power_off( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - *, - skip_shutdown: bool = False, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached - and you are getting charged for the resources. Instead, use deallocate to release resources and - avoid charges. Additionally, this operation is not allowed on a virtual machine that is being - deallocated or already has been deallocated. + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineScaleSet"]: + """Gets all the VM scale sets under the specified subscription for the specified location. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this - flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. Default value is False. - :paramtype skip_shutdown: bool - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param location: The name of Azure region. Required. + :type location: str + :return: An iterator like instance of either VirtualMachineScaleSet or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._power_off_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - skip_shutdown=skip_shutdown, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + cls: ClsType[_models.VirtualMachineScaleSetListResult] = kwargs.pop("cls", None) - async def _restart_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7432,106 +5839,77 @@ async def _restart_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + _request = build_virtual_machine_scale_sets_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machine_scale_set_vms_restart_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restarts a virtual machine in a VM scale set. + @distributed_trace + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineScaleSet"]: + """Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource + group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this + till nextLink is null to fetch all the VM Scale Sets. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An iterator like instance of either VirtualMachineScaleSet or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + cls: ClsType[_models.VirtualMachineScaleSetListWithLinkResult] = kwargs.pop("cls", None) - async def _start_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7540,106 +5918,162 @@ async def _start_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + _request = build_virtual_machine_scale_sets_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machine_scale_set_vms_start_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def begin_start( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Starts a virtual machine in a VM scale set. + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineScaleSet"]: + """Gets a list of all VM scale sets under a resource group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An iterator like instance of either VirtualMachineScaleSet or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.VirtualMachineScaleSetListResult] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response - async def _redeploy_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncIterator[bytes]: + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vm_scale_set_name: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetVMScaleSets]] = None, + **kwargs: Any + ) -> _models.VirtualMachineScaleSet: + """Display information about a virtual machine scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :keyword expand: The expand expression to apply on the operation. 'UserData' retrieves the + UserData property of the VM scale set that was provided by the user during the VM scale set + Create/Update operation. "userData" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForGetVMScaleSets + :return: VirtualMachineScaleSet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7652,173 +6086,46 @@ async def _redeploy_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_redeploy_request( + _request = build_virtual_machine_scale_sets_get_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_redeploy( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and - powers it back on. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._redeploy_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def retrieve_boot_diagnostics_data( + async def _create_or_update_initial( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, + parameters: Union[_models.VirtualMachineScaleSet, IO[bytes]], *, - sas_uri_expiration_time_in_minutes: Optional[int] = None, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, **kwargs: Any - ) -> _models.RetrieveBootDiagnosticsDataResult: - """The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale - set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs - with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated - with a default expiration duration of 120 minutes. Default value is None. - :paramtype sas_uri_expiration_time_in_minutes: int - :return: RetrieveBootDiagnosticsDataResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RetrieveBootDiagnosticsDataResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RetrieveBootDiagnosticsDataResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _perform_maintenance_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7828,18 +6135,31 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_perform_maintenance_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualMachineScaleSet") + + _request = build_virtual_machine_scale_sets_create_or_update_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -7853,7 +6173,7 @@ async def _perform_maintenance_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -7861,131 +6181,190 @@ async def _perform_maintenance_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_perform_maintenance( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Performs maintenance on a virtual machine in a VM scale set. + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: _models.VirtualMachineScaleSet, + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: + """Create or update a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param parameters: The scale set object. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._perform_maintenance_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace_async - async def simulate_eviction( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> None: - """The operation to simulate the eviction of spot virtual machine in a VM scale set. + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: IO[bytes], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: + """Create or update a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: + :param parameters: The scale set object. Required. + :type parameters: IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: Union[_models.VirtualMachineScaleSet, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The scale set object. Is either a VirtualMachineScaleSet type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet or IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - _request = build_virtual_machine_scale_set_vms_simulate_eviction_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.VirtualMachineScaleSet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VirtualMachineScaleSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - async def _attach_detach_data_disks_initial( + async def _update_initial( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSetUpdate, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -8009,13 +6388,14 @@ async def _attach_detach_data_disks_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "AttachDetachDataDisksRequest") + _json = self._serialize.body(parameters, "VirtualMachineScaleSetUpdate") - _request = build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( + _request = build_virtual_machine_scale_sets_update_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, content_type=content_type, json=_json, @@ -8033,7 +6413,7 @@ async def _attach_detach_data_disks_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -8042,8 +6422,8 @@ async def _attach_detach_data_disks_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -8053,95 +6433,117 @@ async def _attach_detach_data_disks_initial( return deserialized # type: ignore @overload - async def begin_attach_detach_data_disks( + async def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: _models.AttachDetachDataDisksRequest, + parameters: _models.VirtualMachineScaleSetUpdate, *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: + """Update a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest + :param parameters: The scale set object. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetUpdate + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of - cls(response) + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result + of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_attach_detach_data_disks( + async def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, parameters: IO[bytes], *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: + """Update a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. + :param parameters: The scale set object. Required. :type parameters: IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of - cls(response) + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result + of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_attach_detach_data_disks( + async def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSetUpdate, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSet]: + """Update a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Is either a AttachDetachDataDisksRequest type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest or + :param parameters: The scale set object. Is either a VirtualMachineScaleSetUpdate type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of - cls(response) + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSet or the result + of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -8149,16 +6551,17 @@ async def begin_attach_detach_data_disks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._attach_detach_data_disks_initial( + raw_result = await self._update_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -8170,10 +6573,15 @@ async def begin_attach_detach_data_disks( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageProfile", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized if polling is True: polling_method: AsyncPollingMethod = cast( @@ -8184,23 +6592,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.StorageProfile].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineScaleSet].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.StorageProfile]( + return AsyncLROPoller[_models.VirtualMachineScaleSet]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _run_command_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **kwargs: Any + async def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8210,30 +6613,18 @@ async def _run_command_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RunCommandInput") - - _request = build_virtual_machine_scale_set_vms_run_command_request( + _request = build_virtual_machine_scale_sets_delete_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, + force_deletion=force_deletion, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -8247,7 +6638,7 @@ async def _run_command_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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): @@ -8255,118 +6646,50 @@ async def _run_command_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: _models.RunCommandInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_run_command( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. + async def begin_delete( + self, resource_group_name: str, vm_scale_set_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Is either a - RunCommandInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] + :keyword force_deletion: Optional parameter to force delete a VM scale set. (Feature in + Preview). Default value is None. + :paramtype force_deletion: bool + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - parameters=parameters, + force_deletion=force_deletion, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -8375,11 +6698,9 @@ async def begin_run_command( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RunCommandResult", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -8390,43 +6711,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.RunCommandResult].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.RunCommandResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - -class VirtualMachineExtensionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machine_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _create_or_update_initial( + async def _approve_rolling_upgrade_initial( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtension, IO[bytes]], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -8447,15 +6744,17 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _json = self._serialize.body(extension_parameters, "VirtualMachineExtension") + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None - _request = build_virtual_machine_extensions_create_or_update_request( + _request = build_virtual_machine_scale_sets_approve_rolling_upgrade_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -8474,7 +6773,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -8482,105 +6781,98 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_create_or_update( + async def begin_approve_rolling_upgrade( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineExtension, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineExtension]: - """The operation to create or update the extension. + ) -> AsyncLROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be created or - updated. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_approve_rolling_upgrade( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: IO[bytes], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineExtension]: - """The operation to create or update the extension. + ) -> AsyncLROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be created or - updated. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def begin_approve_rolling_upgrade( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtension, IO[bytes]], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineExtension]: - """The operation to create or update the extension. + ) -> AsyncLROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be created or - updated. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Is either a VirtualMachineExtension type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -8588,16 +6880,15 @@ async def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._approve_rolling_upgrade_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - extension_parameters=extension_parameters, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -8608,35 +6899,163 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachineExtension].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachineExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @overload + async def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: _models.VMScaleSetConvertToSinglePlacementGroupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. + :type parameters: + ~azure.mgmt.compute.v2024_11_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: Union[_models.VMScaleSetConvertToSinglePlacementGroupInput, IO[bytes]], + **kwargs: Any + ) -> None: + """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The input object for ConvertToSinglePlacementGroup API. Is either a + VMScaleSetConvertToSinglePlacementGroupInput type or a IO[bytes] type. Required. + :type parameters: + ~azure.mgmt.compute.v2024_11_01.models.VMScaleSetConvertToSinglePlacementGroupInput or + IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VMScaleSetConvertToSinglePlacementGroupInput") + + _request = build_virtual_machine_scale_sets_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, ) + _request.url = self._client.format_url(_request.url) - async def _update_initial( + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _deallocate_initial( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtensionUpdate, IO[bytes]], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + *, + hibernate: Optional[bool] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -8657,16 +7076,19 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _json = self._serialize.body(extension_parameters, "VirtualMachineExtensionUpdate") + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None - _request = build_virtual_machine_extensions_update_request( + _request = build_virtual_machine_scale_sets_deallocate_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + hibernate=hibernate, api_version=api_version, content_type=content_type, json=_json, @@ -8684,7 +7106,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -8692,106 +7114,118 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_update( + async def begin_deallocate( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineExtensionUpdate, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, *, + hibernate: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineExtension]: - """The operation to update the extension. + ) -> AsyncLROPoller[None]: + """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and + releases the compute resources. You are not billed for the compute resources that this virtual + machine scale set deallocates. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be updated. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionUpdate + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_deallocate( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: IO[bytes], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, *, + hibernate: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineExtension]: - """The operation to update the extension. + ) -> AsyncLROPoller[None]: + """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and + releases the compute resources. You are not billed for the compute resources that this virtual + machine scale set deallocates. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be updated. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_deallocate( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtensionUpdate, IO[bytes]], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + *, + hibernate: Optional[bool] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineExtension]: - """The operation to update the extension. + ) -> AsyncLROPoller[None]: + """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and + releases the compute resources. You are not billed for the compute resources that this virtual + machine scale set deallocates. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be updated. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Is either a VirtualMachineExtensionUpdate type or a IO[bytes] type. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -8799,16 +7233,16 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - extension_parameters=extension_parameters, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + hibernate=hibernate, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -8819,31 +7253,35 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachineExtension].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachineExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_initial( - self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any + async def _delete_instances_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8853,18 +7291,30 @@ async def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_extensions_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceRequiredIDs") + + _request = build_virtual_machine_scale_sets_delete_instances_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + force_deletion=force_deletion, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -8878,7 +7328,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -8886,44 +7336,128 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any + @overload + async def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + *, + force_deletion: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to delete the extension. + """Deletes virtual machines in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be deleted. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @overload + async def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: IO[bytes], + *, + force_deletion: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: IO[bytes] + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], + *, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceRequiredIDs type or a IO[bytes] type. Required. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs or IO[bytes] + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_instances_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + force_deletion=force_deletion, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -8937,7 +7471,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -8952,27 +7488,35 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async - async def get( + async def force_recovery_service_fabric_platform_update_domain_walk( # pylint: disable=name-too-long self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, + vm_scale_set_name: str, *, - expand: Optional[str] = None, + platform_update_domain: int, + zone: Optional[str] = None, + placement_group_id: Optional[str] = None, **kwargs: Any - ) -> _models.VirtualMachineExtension: - """The operation to get the extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine containing the extension. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension + ) -> _models.RecoveryWalkResponse: + """Manual platform update domain walk to update virtual machines in a service fabric virtual + machine scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :keyword platform_update_domain: The platform update domain for which a manual recovery walk is + requested. Required. + :paramtype platform_update_domain: int + :keyword zone: The zone in which the manual recovery walk is requested for cross zone virtual + machine scale set. Default value is None. + :paramtype zone: str + :keyword placement_group_id: The placement group id for which the manual recovery walk is + requested. Default value is None. + :paramtype placement_group_id: str + :return: RecoveryWalkResponse or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RecoveryWalkResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8987,14 +7531,15 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) + cls: ClsType[_models.RecoveryWalkResponse] = kwargs.pop("cls", None) - _request = build_virtual_machine_extensions_get_request( + _request = build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - expand=expand, + platform_update_domain=platform_update_domain, + zone=zone, + placement_group_id=placement_group_id, api_version=api_version, headers=_headers, params=_params, @@ -9012,7 +7557,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) + deserialized = self._deserialize("RecoveryWalkResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9020,19 +7565,18 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def list( - self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any - ) -> _models.VirtualMachineExtensionsListResult: - """The operation to get all extensions of a Virtual Machine. + async def get_instance_view( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> _models.VirtualMachineScaleSetInstanceView: + """Gets the status of a VM scale set instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine containing the extension. Required. - :type vm_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineExtensionsListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionsListResult + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: VirtualMachineScaleSetInstanceView or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetInstanceView :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9047,13 +7591,12 @@ async def list( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineExtensionsListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetInstanceView] = kwargs.pop("cls", None) - _request = build_virtual_machine_extensions_list_request( + _request = build_virtual_machine_scale_sets_get_instance_view_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -9071,118 +7614,18 @@ async def list( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineExtensionsListResult", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineScaleSetInstanceView", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - -class VirtualMachinesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machines` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachine"]: - """Gets all the virtual machines under the specified subscription for the specified location. - - :param location: The location for which virtual machines under the subscription are queried. - Required. - :type location: str - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machines_list_by_location_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _capture_initial( + async def _update_instances_initial( self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineCaptureParameters, IO[bytes]], + vm_scale_set_name: str, + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -9203,14 +7646,14 @@ async def _capture_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _json = self._serialize.body(parameters, "VirtualMachineCaptureParameters") + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceRequiredIDs") - _request = build_virtual_machines_capture_request( + _request = build_virtual_machine_scale_sets_update_instances_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -9237,94 +7680,96 @@ async def _capture_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_capture( + async def begin_update_instances( self, resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachineCaptureParameters, + vm_scale_set_name: str, + vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineCaptureResult]: - """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used - to create similar VMs. + ) -> AsyncLROPoller[None]: + """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureParameters + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureResult] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_capture( + async def begin_update_instances( self, resource_group_name: str, - vm_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + vm_instance_i_ds: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineCaptureResult]: - """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used - to create similar VMs. + ) -> AsyncLROPoller[None]: + """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. - :type parameters: IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureResult] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_capture( + async def begin_update_instances( self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineCaptureParameters, IO[bytes]], + vm_scale_set_name: str, + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineCaptureResult]: - """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used - to create similar VMs. + ) -> AsyncLROPoller[None]: + """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Is either a - VirtualMachineCaptureParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureResult] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceRequiredIDs type or a IO[bytes] type. Required. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -9332,15 +7777,15 @@ async def begin_capture( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineCaptureResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._capture_initial( + raw_result = await self._update_instances_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -9351,11 +7796,9 @@ async def begin_capture( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineCaptureResult", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -9366,24 +7809,104 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachineCaptureResult].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachineCaptureResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _create_or_update_initial( + @distributed_trace + def get_os_upgrade_history( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncIterable["_models.UpgradeOperationHistoricalStatusInfo"]: + """Gets list of OS upgrades on a VM scale set instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An iterator like instance of either UpgradeOperationHistoricalStatusInfo or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.UpgradeOperationHistoricalStatusInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetListOSUpgradeHistory] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _perform_maintenance_initial( self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachine, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -9404,17 +7927,18 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _json = self._serialize.body(parameters, "VirtualMachine") + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None - _request = build_virtual_machines_create_or_update_request( + _request = build_virtual_machine_scale_sets_perform_maintenance_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, api_version=api_version, content_type=content_type, json=_json, @@ -9432,7 +7956,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -9440,124 +7964,105 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_create_or_update( + async def begin_perform_maintenance( self, resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachine, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """The operation to create or update a virtual machine. Please note some properties can be set - only during virtual machine creation. + ) -> AsyncLROPoller[None]: + """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances + which are not eligible for perform maintenance will be failed. Please refer to best practices + for more details: + https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachine - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_perform_maintenance( self, resource_group_name: str, - vm_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """The operation to create or update a virtual machine. Please note some properties can be set - only during virtual machine creation. + ) -> AsyncLROPoller[None]: + """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances + which are not eligible for perform maintenance will be failed. Please refer to best practices + for more details: + https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def begin_perform_maintenance( self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachine, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """The operation to create or update a virtual machine. Please note some properties can be set - only during virtual machine creation. + ) -> AsyncLROPoller[None]: + """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances + which are not eligible for perform maintenance will be failed. Please refer to best practices + for more details: + https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Is either a - VirtualMachine type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachine or IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -9565,17 +8070,15 @@ async def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._perform_maintenance_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -9586,37 +8089,34 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachine].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _update_initial( + async def _power_off_initial( self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineUpdate, IO[bytes]], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + skip_shutdown: Optional[bool] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -9637,17 +8137,19 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _json = self._serialize.body(parameters, "VirtualMachineUpdate") + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None - _request = build_virtual_machines_update_request( + _request = build_virtual_machine_scale_sets_power_off_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, + skip_shutdown=skip_shutdown, api_version=api_version, content_type=content_type, json=_json, @@ -9665,7 +8167,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -9673,121 +8175,118 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_update( + async def begin_power_off( self, resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachineUpdate, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + skip_shutdown: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """The operation to update a virtual machine. + ) -> AsyncLROPoller[None]: + """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still + attached and you are getting charged for the resources. Instead, use deallocate to release + resources and avoid charges. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineUpdate - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. Default value is None. + :paramtype skip_shutdown: bool :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_power_off( self, resource_group_name: str, - vm_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + skip_shutdown: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """The operation to update a virtual machine. + ) -> AsyncLROPoller[None]: + """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still + attached and you are getting charged for the resources. Instead, use deallocate to release + resources and avoid charges. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. - :type parameters: IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] + :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. Default value is None. + :paramtype skip_shutdown: bool :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_power_off( self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineUpdate, IO[bytes]], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: - """The operation to update a virtual machine. + ) -> AsyncLROPoller[None]: + """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still + attached and you are getting charged for the resources. Instead, use deallocate to release + resources and avoid charges. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Is either a - VirtualMachineUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineUpdate or IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. Default value is None. + :paramtype skip_shutdown: bool + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -9795,17 +8294,16 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._power_off_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + skip_shutdown=skip_shutdown, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -9816,31 +8314,29 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachine].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_initial( - self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any + async def _reapply_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9856,11 +8352,10 @@ async def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_delete_request( + _request = build_virtual_machine_scale_sets_reapply_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - force_deletion=force_deletion, api_version=api_version, headers=_headers, params=_params, @@ -9875,7 +8370,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -9883,32 +8378,30 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any + async def begin_reapply( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to delete a virtual machine. + """Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine + Instances. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword force_deletion: Optional parameter to force delete virtual machines. - NOTE: As of api-version 2024-11-01, we are rolling out a feature where if the forceDeletion - parameter is unspecified OR not explicitly set to false, AND all of the VM's attached disks - including the OS disk are marked with the delete option, then the VM will be force deleted. For - more details on how to configure delete options for a VM's resources, see `Delete a VM and - attached resources `_. To - avoid defaulting to force delete, ensure that the forceDeletion parameter is explicitly set to - false. This feature is expected to rollout by end of March 2025. Default value is None. - :paramtype force_deletion: bool + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -9922,10 +8415,9 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._reapply_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - force_deletion=force_deletion, + vm_scale_set_name=vm_scale_set_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -9940,7 +8432,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -9954,132 +8448,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace_async - async def get( + async def _redeploy_initial( self, resource_group_name: str, - vm_name: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any - ) -> _models.VirtualMachine: - """Retrieves information about the model view or the instance view of a virtual machine. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves a - snapshot of the runtime properties of the virtual machine that is managed by the platform and - can change outside of control plane operations. 'UserData' retrieves the UserData property as - part of the VM model view that was provided by the user during the VM Create/Update operation. - Known values are: "instanceView", "userData", and "resiliencyView". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes - :return: VirtualMachine or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachine - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - - _request = build_virtual_machines_get_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def instance_view( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> _models.VirtualMachineInstanceView: - """Retrieves information about the run-time state of a virtual machine. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: VirtualMachineInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineInstanceView] = kwargs.pop("cls", None) - - _request = build_virtual_machines_instance_view_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _convert_to_managed_disks_initial( - self, resource_group_name: str, vm_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10089,17 +8463,32 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_convert_to_managed_disks_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None + + _request = build_virtual_machine_scale_sets_redeploy_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -10121,41 +8510,117 @@ async def _convert_to_managed_disks_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + async def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, + and powers them back on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, + and powers them back on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_convert_to_managed_disks( - self, resource_group_name: str, vm_name: str, **kwargs: Any + async def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: - """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be - stop-deallocated before invoking this operation. + """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, + and powers them back on. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._convert_to_managed_disks_initial( + raw_result = await self._redeploy_initial( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -10169,7 +8634,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -10183,8 +8650,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _deallocate_initial( - self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any + async def _reimage_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[Union[_models.VirtualMachineScaleSetReimageParameters, IO[bytes]]] = None, + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10194,18 +8665,32 @@ async def _deallocate_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_deallocate_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vm_scale_set_reimage_input, (IOBase, bytes)): + _content = vm_scale_set_reimage_input + else: + if vm_scale_set_reimage_input is not None: + _json = self._serialize.body(vm_scale_set_reimage_input, "VirtualMachineScaleSetReimageParameters") + else: + _json = None + + _request = build_virtual_machine_scale_sets_reimage_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - hibernate=hibernate, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -10227,44 +8712,118 @@ async def _deallocate_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[_models.VirtualMachineScaleSetReimageParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which + don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual + machine is reset to initial state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetReimageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which + don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual + machine is reset to initial state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. + :type vm_scale_set_reimage_input: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_deallocate( - self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[Union[_models.VirtualMachineScaleSetReimageParameters, IO[bytes]]] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: - """Shuts down the virtual machine and releases the compute resources. You are not billed for the - compute resources that this virtual machine uses. + """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which + don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual + machine is reset to initial state. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword hibernate: Optional parameter to hibernate a virtual machine. Default value is None. - :paramtype hibernate: bool + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Is either a + VirtualMachineScaleSetReimageParameters type or a IO[bytes] type. Default value is None. + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetReimageParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._deallocate_initial( + raw_result = await self._reimage_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - hibernate=hibernate, + vm_scale_set_name=vm_scale_set_name, + vm_scale_set_reimage_input=vm_scale_set_reimage_input, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -10278,7 +8837,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -10292,23 +8853,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace_async - async def generalize(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> None: - """Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the - virtual machine before performing this operation. For Windows, please refer to `Create a - managed image of a generalized VM in Azure - `_. For - Linux, please refer to `How to create an image of a virtual machine or VHD - `_. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _reimage_all_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10317,88 +8868,923 @@ async def generalize(self, resource_group_name: str, vm_name: str, **kwargs: Any } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_generalize_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None + + _request = build_virtual_machine_scale_sets_reimage_all_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore - @distributed_trace - def list( + return deserialized # type: ignore + + @overload + async def begin_reimage_all( self, resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, *, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterable["_models.VirtualMachine"]: - # pylint: disable=line-too-long - """Lists all of the virtual machines in the specified resource group. Use the nextLink property in - the response to get the next page of virtual machines. + ) -> AsyncLROPoller[None]: + """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This + operation is only supported for managed disks. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :keyword filter: The system query option to filter VMs returned in the response. Allowed value - is 'virtualMachineScaleSet/id' eq - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. - Default value is None. - :paramtype filter: str - :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching - run time status of all Virtual Machines, this can only be specified if a valid $filter option - is specified. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.ExpandTypeForListVMs - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + @overload + async def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This + operation is only supported for managed disks. - _request = build_virtual_machines_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This + operation is only supported for managed disks. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None + + _request = build_virtual_machine_scale_sets_restart_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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=_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _set_orchestration_service_state_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: Union[_models.OrchestrationServiceStateInput, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "OrchestrationServiceStateInput") + + _request = build_virtual_machine_scale_sets_set_orchestration_service_state_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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=_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_set_orchestration_service_state( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: _models.OrchestrationServiceStateInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The input object for SetOrchestrationServiceState API. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.OrchestrationServiceStateInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_set_orchestration_service_state( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The input object for SetOrchestrationServiceState API. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_set_orchestration_service_state( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: Union[_models.OrchestrationServiceStateInput, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The input object for SetOrchestrationServiceState API. Is either a + OrchestrationServiceStateInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.OrchestrationServiceStateInput or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._set_orchestration_service_state_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_skus( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineScaleSetSku"]: + """Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM + instances allowed for each SKU. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An iterator like instance of either VirtualMachineScaleSetSku or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetListSkusResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _start_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None + + _request = build_virtual_machine_scale_sets_start_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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=_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class VirtualMachinesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`virtual_machines` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachine"]: + """Gets all the virtual machines under the specified subscription for the specified location. + + :param location: The name of Azure region. Required. + :type location: str + :return: An iterator like instance of either VirtualMachine or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, headers=_headers, params=_params, ) @@ -10454,7 +9840,6 @@ def list_all( expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, **kwargs: Any ) -> AsyncIterable["_models.VirtualMachine"]: - # pylint: disable=line-too-long """Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. @@ -10545,26 +9930,39 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list_available_sizes( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncIterable["_models.VirtualMachineSize"]: - """Lists all available virtual machine sizes to which the specified virtual machine can be - resized. + def list( + self, + resource_group_name: str, + *, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachine"]: + """Lists all of the virtual machines in the specified resource group. Use the nextLink property in + the response to get the next page of virtual machines. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) + :keyword filter: The system query option to filter VMs returned in the response. Allowed value + is 'virtualMachineScaleSet/id' eq + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + Default value is None. + :paramtype filter: str + :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching + run time status of all Virtual Machines, this can only be specified if a valid $filter option + is specified. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.ExpandTypeForListVMs + :return: An iterator like instance of either VirtualMachine or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10577,10 +9975,11 @@ def list_available_sizes( def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machines_list_available_sizes_request( + _request = build_virtual_machines_list_request( resource_group_name=resource_group_name, - vm_name=vm_name, subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -10605,11 +10004,11 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -10628,9 +10027,32 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _power_off_initial( - self, resource_group_name: str, vm_name: str, *, skip_shutdown: bool = False, **kwargs: Any - ) -> AsyncIterator[bytes]: + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vm_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.VirtualMachine: + """Retrieves information about the model view or the instance view of a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves a + snapshot of the runtime properties of the virtual machine that is managed by the platform and + can change outside of control plane operations. 'UserData' retrieves the UserData property as + part of the VM model view that was provided by the user during the VM Create/Update operation. + Known values are: "instanceView", "userData", and "resiliencyView". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes + :return: VirtualMachine or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachine + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10643,14 +10065,80 @@ async def _power_off_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + + _request = build_virtual_machines_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachine, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_power_off_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualMachine") + + _request = build_virtual_machines_create_or_update_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -10664,7 +10152,7 @@ async def _power_off_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -10672,48 +10160,152 @@ async def _power_off_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + parameters: _models.VirtualMachine, + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """The operation to create or update a virtual machine. Please note some properties can be set + only during virtual machine creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachine + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + parameters: IO[bytes], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """The operation to create or update a virtual machine. Please note some properties can be set + only during virtual machine creation. - return deserialized # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_power_off( - self, resource_group_name: str, vm_name: str, *, skip_shutdown: bool = False, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to power off (stop) a virtual machine. The virtual machine can be restarted with - the same provisioned resources. You are still charged for this virtual machine. NOTE: This - operation is not allowed on a virtual machine that is being deallocated or has already been - deallocated. + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachine, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """The operation to create or update a virtual machine. Please note some properties can be set + only during virtual machine creation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this - flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. Default value is False. - :paramtype skip_shutdown: bool - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param parameters: Parameters supplied to the Create Virtual Machine operation. Is either a + VirtualMachine type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachine or IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._power_off_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, vm_name=vm_name, - skip_shutdown=skip_shutdown, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -10722,26 +10314,41 @@ async def begin_power_off( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachine].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.VirtualMachine]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + async def _update_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachineUpdate, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10750,17 +10357,31 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_reapply_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualMachineUpdate") + + _request = build_virtual_machines_update_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -10774,7 +10395,7 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -10782,38 +10403,148 @@ async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwarg map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + parameters: _models.VirtualMachineUpdate, + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineUpdate + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + parameters: IO[bytes], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :type parameters: IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_reapply(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """The operation to reapply a virtual machine's state. + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachineUpdate, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param parameters: Parameters supplied to the Update Virtual Machine operation. Is either a + VirtualMachineUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineUpdate or IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._reapply_initial( + raw_result = await self._update_initial( resource_group_name=resource_group_name, vm_name=vm_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -10822,26 +10553,39 @@ async def begin_reapply(self, resource_group_name: str, vm_name: str, **kwargs: await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachine].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.VirtualMachine]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + async def _delete_initial( + self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10856,10 +10600,11 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_restart_request( + _request = build_virtual_machines_delete_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + force_deletion=force_deletion, api_version=api_version, headers=_headers, params=_params, @@ -10874,7 +10619,7 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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): @@ -10882,21 +10627,32 @@ async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwarg map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_restart(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """The operation to restart a virtual machine. + async def begin_delete( + self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete a virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str + :keyword force_deletion: Optional parameter to force delete virtual machines. Default value is + None. + :paramtype force_deletion: bool :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -10910,9 +10666,10 @@ async def begin_restart(self, resource_group_name: str, vm_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._restart_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + force_deletion=force_deletion, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -10927,7 +10684,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -10941,7 +10700,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + async def _assess_patches_initial( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10956,7 +10717,7 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_start_request( + _request = build_virtual_machines_assess_patches_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, @@ -10982,35 +10743,45 @@ async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_start(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """The operation to start a virtual machine. + async def begin_assess_patches( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineAssessPatchesResult]: + """Assess patches on the VM. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns either VirtualMachineAssessPatchesResult or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineAssessPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._assess_patches_initial( resource_group_name=resource_group_name, vm_name=vm_name, api_version=api_version, @@ -11022,26 +10793,38 @@ async def begin_start(self, resource_group_name: str, vm_name: str, **kwargs: An await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineAssessPatchesResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineAssessPatchesResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.VirtualMachineAssessPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + async def _attach_detach_data_disks_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11050,17 +10833,29 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_redeploy_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AttachDetachDataDisksRequest") + + _request = build_virtual_machines_attach_detach_data_disks_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -11082,38 +10877,119 @@ async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwar map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: _models.AttachDetachDataDisksRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_redeploy(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Shuts down the virtual machine, moves it to a new node, and powers it back on. + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Is either a AttachDetachDataDisksRequest type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._redeploy_initial( + raw_result = await self._attach_detach_data_disks_initial( resource_group_name=resource_group_name, vm_name=vm_name, + parameters=parameters, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -11122,30 +10998,36 @@ async def begin_redeploy(self, resource_group_name: str, vm_name: str, **kwargs: await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("StorageProfile", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.StorageProfile].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.StorageProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _reimage_initial( + async def _capture_initial( self, resource_group_name: str, vm_name: str, - parameters: Optional[Union[_models.VirtualMachineReimageParameters, IO[bytes]]] = None, + parameters: Union[_models.VirtualMachineCaptureParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -11169,12 +11051,9 @@ async def _reimage_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - if parameters is not None: - _json = self._serialize.body(parameters, "VirtualMachineReimageParameters") - else: - _json = None + _json = self._serialize.body(parameters, "VirtualMachineCaptureParameters") - _request = build_virtual_machines_reimage_request( + _request = build_virtual_machines_capture_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, @@ -11203,102 +11082,102 @@ async def _reimage_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_reimage( + async def begin_capture( self, resource_group_name: str, vm_name: str, - parameters: Optional[_models.VirtualMachineReimageParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, - for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial - state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. + parameters: _models.VirtualMachineCaptureParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineCaptureResult]: + """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used + to create similar VMs. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineReimageParameters + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_reimage( + async def begin_capture( self, resource_group_name: str, vm_name: str, - parameters: Optional[IO[bytes]] = None, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, - for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial - state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. + ) -> AsyncLROPoller[_models.VirtualMachineCaptureResult]: + """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used + to create similar VMs. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_reimage( + async def begin_capture( self, resource_group_name: str, vm_name: str, - parameters: Optional[Union[_models.VirtualMachineReimageParameters, IO[bytes]]] = None, + parameters: Union[_models.VirtualMachineCaptureParameters, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, - for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial - state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. + ) -> AsyncLROPoller[_models.VirtualMachineCaptureResult]: + """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used + to create similar VMs. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Is either a - VirtualMachineReimageParameters type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineReimageParameters or + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Is either a + VirtualMachineCaptureParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns either VirtualMachineCaptureResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -11306,12 +11185,12 @@ async def begin_reimage( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineCaptureResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._reimage_initial( + raw_result = await self._capture_initial( resource_group_name=resource_group_name, vm_name=vm_name, parameters=parameters, @@ -11325,92 +11204,32 @@ async def begin_reimage( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineCaptureResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineCaptureResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def retrieve_boot_diagnostics_data( - self, - resource_group_name: str, - vm_name: str, - *, - sas_uri_expiration_time_in_minutes: Optional[int] = None, - **kwargs: Any - ) -> _models.RetrieveBootDiagnosticsDataResult: - """The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs - with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated - with a default expiration duration of 120 minutes. Default value is None. - :paramtype sas_uri_expiration_time_in_minutes: int - :return: RetrieveBootDiagnosticsDataResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RetrieveBootDiagnosticsDataResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - - _request = build_virtual_machines_retrieve_boot_diagnostics_data_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + return AsyncLROPoller[_models.VirtualMachineCaptureResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RetrieveBootDiagnosticsDataResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _perform_maintenance_initial( + async def _convert_to_managed_disks_initial( self, resource_group_name: str, vm_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -11427,7 +11246,7 @@ async def _perform_maintenance_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_perform_maintenance_request( + _request = build_virtual_machines_convert_to_managed_disks_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, @@ -11453,20 +11272,27 @@ async def _perform_maintenance_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_perform_maintenance( + async def begin_convert_to_managed_disks( self, resource_group_name: str, vm_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to perform maintenance on a virtual machine. + """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be + stop-deallocated before invoking this operation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str @@ -11483,7 +11309,7 @@ async def begin_perform_maintenance( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._perform_maintenance_initial( + raw_result = await self._convert_to_managed_disks_initial( resource_group_name=resource_group_name, vm_name=vm_name, api_version=api_version, @@ -11500,7 +11326,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -11514,58 +11342,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace_async - async def simulate_eviction(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> None: - """The operation to simulate the eviction of spot virtual machine. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_virtual_machines_simulate_eviction_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - async def _assess_patches_initial( - self, resource_group_name: str, vm_name: str, **kwargs: Any + async def _deallocate_initial( + self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11581,10 +11359,11 @@ async def _assess_patches_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_assess_patches_request( + _request = build_virtual_machines_deallocate_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + hibernate=hibernate, api_version=api_version, headers=_headers, params=_params, @@ -11607,41 +11386,49 @@ async def _assess_patches_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_assess_patches( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineAssessPatchesResult]: - """Assess patches on the VM. + async def begin_deallocate( + self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Shuts down the virtual machine and releases the compute resources. You are not billed for the + compute resources that this virtual machine uses. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineAssessPatchesResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineAssessPatchesResult] + :keyword hibernate: Optional parameter to hibernate a virtual machine. Default value is None. + :paramtype hibernate: bool + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._assess_patches_initial( + raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + hibernate=hibernate, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -11651,11 +11438,9 @@ async def begin_assess_patches( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineAssessPatchesResult", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -11666,16 +11451,70 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachineAssessPatchesResult].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachineAssessPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def generalize(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> None: + """Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the + virtual machine before performing this operation. For Windows, please refer to `Create a + managed image of a generalized VM in Azure + `_. For + Linux, please refer to `How to create an image of a virtual machine or VHD + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_virtual_machines_generalize_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + async def _install_patches_initial( self, resource_group_name: str, @@ -11735,10 +11574,15 @@ async def _install_patches_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -11754,7 +11598,8 @@ async def begin_install_patches( ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: """Installs patches on the VM. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str @@ -11784,7 +11629,8 @@ async def begin_install_patches( ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: """Installs patches on the VM. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str @@ -11811,7 +11657,8 @@ async def begin_install_patches( ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: """Installs patches on the VM. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str @@ -11874,13 +11721,21 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _attach_detach_data_disks_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: + @distributed_trace_async + async def instance_view( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> _models.VirtualMachineInstanceView: + """Retrieves information about the run-time state of a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: VirtualMachineInstanceView or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11889,192 +11744,40 @@ async def _attach_detach_data_disks_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AttachDetachDataDisksRequest") + cls: ClsType[_models.VirtualMachineInstanceView] = kwargs.pop("cls", None) - _request = build_virtual_machines_attach_detach_data_disks_request( + _request = build_virtual_machines_instance_view_request( resource_group_name=resource_group_name, vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _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=_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.AttachDetachDataDisksRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Is either a AttachDetachDataDisksRequest type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._attach_detach_data_disks_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageProfile", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.StorageProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.StorageProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualMachineInstanceView", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + async def _migrate_to_vm_scale_set_initial( self, resource_group_name: str, @@ -12137,10 +11840,14 @@ async def _migrate_to_vm_scale_set_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -12156,7 +11863,8 @@ async def begin_migrate_to_vm_scale_set( ) -> AsyncLROPoller[None]: """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str @@ -12183,7 +11891,8 @@ async def begin_migrate_to_vm_scale_set( ) -> AsyncLROPoller[None]: """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str @@ -12208,7 +11917,8 @@ async def begin_migrate_to_vm_scale_set( ) -> AsyncLROPoller[None]: """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str @@ -12249,7 +11959,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -12263,12 +11975,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _run_command_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **kwargs: Any + async def _perform_maintenance_initial( + self, resource_group_name: str, vm_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12278,29 +11986,17 @@ async def _run_command_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RunCommandInput") - - _request = build_virtual_machines_run_command_request( + _request = build_virtual_machines_perform_maintenance_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -12322,108 +12018,165 @@ async def _run_command_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def begin_run_command( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.RunCommandInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on the VM. + @distributed_trace_async + async def begin_perform_maintenance( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to perform maintenance on a virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @overload - async def begin_run_command( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on the VM. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _power_off_initial( + self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_power_off_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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=_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async - async def begin_run_command( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.RunCommandResult]: - """Run command on the VM. + async def begin_power_off( + self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to power off (stop) a virtual machine. The virtual machine can be restarted with + the same provisioned resources. You are still charged for this virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Is either a - RunCommandInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] + :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. Default value is None. + :paramtype skip_shutdown: bool + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, - parameters=parameters, + skip_shutdown=skip_shutdown, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -12432,11 +12185,9 @@ async def begin_run_command( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RunCommandResult", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -12447,57 +12198,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.RunCommandResult].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.RunCommandResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - -class VirtualMachineImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machine_images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get( - self, location: str, publisher_name: str, offer: str, skus: str, version: str, **kwargs: Any - ) -> _models.VirtualMachineImage: - """Gets a virtual machine image. + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param version: A valid image SKU version. Required. - :type version: str - :return: VirtualMachineImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12510,14 +12219,11 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_get_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, - version=version, + _request = build_virtual_machines_reapply_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -12525,58 +12231,90 @@ async def get( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineImage", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def list( - self, - location: str, - publisher_name: str, - offer: str, - skus: str, - *, - expand: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of all virtual machine image versions for the specified location, publisher, offer, - and SKU. + async def begin_reapply(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """The operation to reapply a virtual machine's state. - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :keyword top: Default value is None. - :paramtype top: int - :keyword orderby: Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reapply_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12589,55 +12327,108 @@ async def list( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_list_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, + _request = build_virtual_machines_redeploy_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def list_offers( - self, location: str, publisher_name: str, **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of virtual machine image offers for the specified location and publisher. + async def begin_redeploy(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Shuts down the virtual machine, moves it to a new node, and powers it back on. - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _reimage_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.VirtualMachineReimageParameters, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12646,164 +12437,205 @@ async def list_offers( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_list_offers_request( - location=location, - publisher_name=publisher_name, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VirtualMachineReimageParameters") + else: + _json = None + + _request = build_virtual_machines_reimage_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def list_publishers(self, location: str, **kwargs: Any) -> List[_models.VirtualMachineImageResource]: - """Gets a list of virtual machine image publishers for the specified Azure location. + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[_models.VirtualMachineReimageParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, + for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. - :param location: The name of a supported Azure region. Required. - :type location: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineReimageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_images_list_publishers_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, + for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. - return deserialized # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def list_skus( - self, location: str, publisher_name: str, offer: str, **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + async def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.VirtualMachineReimageParameters, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, + for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Is either a + VirtualMachineReimageParameters type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineReimageParameters or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_images_list_skus_request( - location=location, - publisher_name=publisher_name, - offer=offer, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - return deserialized # type: ignore + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace_async - async def list_by_edge_zone( - self, location: str, edge_zone: str, **kwargs: Any - ) -> _models.VmImagesInEdgeZoneListResult: - """Gets a list of all virtual machine image versions for the specified edge zone. + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - :param location: The name of a supported Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :return: VmImagesInEdgeZoneListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VmImagesInEdgeZoneListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12816,11 +12648,11 @@ async def list_by_edge_zone( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VmImagesInEdgeZoneListResult] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_list_by_edge_zone_request( - location=location, - edge_zone=edge_zone, + _request = build_virtual_machines_restart_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -12828,64 +12660,113 @@ async def list_by_edge_zone( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VmImagesInEdgeZoneListResult", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_with_properties( - self, - location: str, - publisher_name: str, - offer: str, - skus: str, - *, - expand: Union[str, _models.Expand], - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.VirtualMachineImage"]: - """list_with_properties. + @distributed_trace_async + async def begin_restart(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """The operation to restart a virtual machine. - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :keyword expand: The expand expression to apply on the operation. "Properties" Required. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.Expand - :keyword top: Default value is None. - :paramtype top: int - :keyword orderby: Default value is None. - :paramtype orderby: str - :return: An iterator like instance of either VirtualMachineImage or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineImagesWithPropertiesListResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def retrieve_boot_diagnostics_data( + self, + resource_group_name: str, + vm_name: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> _models.RetrieveBootDiagnosticsDataResult: + """The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs + with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated + with a default expiration duration of 120 minutes. Default value is None. + :paramtype sas_uri_expiration_time_in_minutes: int + :return: RetrieveBootDiagnosticsDataResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RetrieveBootDiagnosticsDataResult + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12894,108 +12775,48 @@ def list_with_properties( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machine_images_list_with_properties_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, - subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineImagesWithPropertiesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - return pipeline_response + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - return AsyncItemPaged(get_next, extract_data) + _request = build_virtual_machines_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) -class VirtualMachineImagesEdgeZoneOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + response = pipeline_response.http_response - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machine_images_edge_zone` attribute. - """ + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - models = _models + deserialized = self._deserialize("RetrieveBootDiagnosticsDataResult", pipeline_response.http_response) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - @distributed_trace_async - async def get( - self, location: str, edge_zone: str, publisher_name: str, offer: str, skus: str, version: str, **kwargs: Any - ) -> _models.VirtualMachineImage: - """Gets a virtual machine image in an edge zone. + return deserialized # type: ignore - :param location: The name of a supported Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param version: A valid image SKU version. Required. - :type version: str - :return: VirtualMachineImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _run_command_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.RunCommandInput, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13004,81 +12825,204 @@ async def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_edge_zone_get_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - skus=skus, - version=version, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RunCommandInput") + + _request = build_virtual_machines_run_command_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineImage", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def list( + @overload + async def begin_run_command( self, - location: str, - edge_zone: str, - publisher_name: str, - offer: str, - skus: str, + resource_group_name: str, + vm_name: str, + parameters: _models.RunCommandInput, *, - expand: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of all virtual machine image versions for the specified location, edge zone, - publisher, offer, and SKU. + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on the VM. - :param location: The name of a supported Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :keyword top: An integer value specifying the number of images to return that matches supplied - values. Default value is None. - :paramtype top: int - :keyword orderby: Specifies the order of the results returned. Formatted as an OData query. - Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.RunCommandInput, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Run command operation. Is either a + RunCommandInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput or IO[bytes] + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._run_command_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RunCommandResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.RunCommandResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RunCommandResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def simulate_eviction(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> None: + """The operation to simulate the eviction of spot virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13093,18 +13037,12 @@ async def list( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_edge_zone_list_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - skus=skus, + _request = build_virtual_machines_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, api_version=api_version, headers=_headers, params=_params, @@ -13118,34 +13056,14 @@ async def list( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list_offers( - self, location: str, edge_zone: str, publisher_name: str, **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of virtual machine image offers for the specified location, edge zone and - publisher. + return cls(pipeline_response, None, {}) # type: ignore - :param location: The name of a supported Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13158,12 +13076,11 @@ async def list_offers( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_images_edge_zone_list_offers_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machines_start_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -13171,38 +13088,112 @@ async def list_offers( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def list_publishers( - self, location: str, edge_zone: str, **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + async def begin_start(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """The operation to start a virtual machine. - :param location: The name of a supported Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_available_sizes( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineSize"]: + """Lists all available virtual machine sizes to which the specified virtual machine can be + resized. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13211,59 +13202,99 @@ async def list_publishers( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + _request = build_virtual_machines_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machine_images_edge_zone_list_publishers_request( - location=location, - edge_zone=edge_zone, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def list_skus( - self, location: str, edge_zone: str, publisher_name: str, offer: str, **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and - offer. - :param location: The name of a supported Azure region. Required. +class VirtualMachineSizesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`virtual_machine_sizes` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineSize"]: + """This API is deprecated. Use `Resources Skus + `_. + + :param location: The name of Azure region. Required. :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13272,81 +13303,96 @@ async def list_skus( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + _request = build_virtual_machine_sizes_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machine_images_edge_zone_list_skus_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) -class VirtualMachineExtensionImagesOperations: +class ProximityPlacementGroupsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machine_extension_images` attribute. + :attr:`proximity_placement_groups` attribute. """ models = _models def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - @distributed_trace_async - async def get( - self, location: str, publisher_name: str, type: str, version: str, **kwargs: Any - ) -> _models.VirtualMachineExtensionImage: - """Gets a virtual machine extension image. + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ProximityPlacementGroup"]: + """Lists all proximity placement groups in a subscription. - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :param type: Required. - :type type: str - :param version: Required. - :type version: str - :return: VirtualMachineExtensionImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionImage + :return: An iterator like instance of either ProximityPlacementGroup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.ProximityPlacementGroupListResult] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13355,56 +13401,79 @@ async def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineExtensionImage] = kwargs.pop("cls", None) + _request = build_proximity_placement_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machine_extension_images_get_request( - location=location, - publisher_name=publisher_name, - type=type, - version=version, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("VirtualMachineExtensionImage", pipeline_response.http_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def list_types( - self, location: str, publisher_name: str, **kwargs: Any - ) -> List[_models.VirtualMachineExtensionImage]: - """Gets a list of virtual machine extension image types. + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ProximityPlacementGroup"]: + """Lists all proximity placement groups in a resource group. - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :return: list of VirtualMachineExtensionImage or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionImage] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either ProximityPlacementGroup or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.ProximityPlacementGroupListResult] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13413,68 +13482,80 @@ async def list_types( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) + _request = build_proximity_placement_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machine_extension_images_list_types_request( - location=location, - publisher_name=publisher_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("[VirtualMachineExtensionImage]", pipeline_response.http_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def list_versions( + async def get( self, - location: str, - publisher_name: str, - type: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any - ) -> List[_models.VirtualMachineExtensionImage]: - """Gets a list of virtual machine extension image versions. - - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :param type: Required. - :type type: str - :keyword filter: The filter to apply on the operation. Default value is None. - :paramtype filter: str - :keyword top: Default value is None. - :paramtype top: int - :keyword orderby: Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineExtensionImage or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionImage] + resource_group_name: str, + proximity_placement_group_name: str, + *, + include_colocation_status: Optional[str] = None, + **kwargs: Any + ) -> _models.ProximityPlacementGroup: + """Retrieves information about a proximity placement group . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :keyword include_colocation_status: includeColocationStatus=true enables fetching the + colocation status of all the resources in the proximity placement group. Default value is None. + :paramtype include_colocation_status: str + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13489,16 +13570,13 @@ async def list_versions( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) - _request = build_virtual_machine_extension_images_list_versions_request( - location=location, - publisher_name=publisher_name, - type=type, + _request = build_proximity_placement_groups_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, - filter=filter, - top=top, - orderby=orderby, + include_colocation_status=include_colocation_status, api_version=api_version, headers=_headers, params=_params, @@ -13516,57 +13594,38 @@ async def list_versions( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VirtualMachineExtensionImage]", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - -class AvailabilitySetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`availability_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - @overload async def create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.AvailabilitySet, + proximity_placement_group_name: str, + parameters: _models.ProximityPlacementGroup, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -13574,25 +13633,27 @@ async def create_or_update( async def create_or_update( self, resource_group_name: str, - availability_set_name: str, + proximity_placement_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -13600,21 +13661,22 @@ async def create_or_update( async def create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.AvailabilitySet, IO[bytes]], + proximity_placement_group_name: str, + parameters: Union[_models.ProximityPlacementGroup, IO[bytes]], **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Is either a - AvailabilitySet type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet or IO[bytes] - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Is + either a ProximityPlacementGroup type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup or IO[bytes] + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13630,7 +13692,7 @@ async def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -13638,11 +13700,11 @@ async def create_or_update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "AvailabilitySet") + _json = self._serialize.body(parameters, "ProximityPlacementGroup") - _request = build_availability_sets_create_or_update_request( + _request = build_proximity_placement_groups_create_or_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -13660,11 +13722,11 @@ async def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13675,25 +13737,27 @@ async def create_or_update( async def update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.AvailabilitySetUpdate, + proximity_placement_group_name: str, + parameters: _models.ProximityPlacementGroupUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySetUpdate + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -13701,25 +13765,27 @@ async def update( async def update( self, resource_group_name: str, - availability_set_name: str, + proximity_placement_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -13727,21 +13793,23 @@ async def update( async def update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.AvailabilitySetUpdate, IO[bytes]], + proximity_placement_group_name: str, + parameters: Union[_models.ProximityPlacementGroupUpdate, IO[bytes]], **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Is either a - AvailabilitySetUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySetUpdate or IO[bytes] - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Is + either a ProximityPlacementGroupUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroupUpdate or + IO[bytes] + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13757,7 +13825,7 @@ async def update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -13765,11 +13833,11 @@ async def update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "AvailabilitySetUpdate") + _json = self._serialize.body(parameters, "ProximityPlacementGroupUpdate") - _request = build_availability_sets_update_request( + _request = build_proximity_placement_groups_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -13791,7 +13859,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13799,65 +13867,16 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def delete(self, resource_group_name: str, availability_set_name: str, **kwargs: Any) -> None: - """Delete an availability set. + async def delete(self, resource_group_name: str, proximity_placement_group_name: str, **kwargs: Any) -> None: + """Delete a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_availability_sets_delete_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, availability_set_name: str, **kwargs: Any) -> _models.AvailabilitySet: - """Retrieves information about an availability set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13872,11 +13891,11 @@ async def get(self, resource_group_name: str, availability_set_name: str, **kwar _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_availability_sets_get_request( + _request = build_proximity_placement_groups_delete_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -13895,32 +13914,47 @@ async def get(self, resource_group_name: str, availability_set_name: str, **kwar map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - return deserialized # type: ignore + +class RestorePointCollectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`restore_point_collections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list_by_subscription( - self, *, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.AvailabilitySet"]: - """Lists all availability sets in a subscription. + def list_all(self, **kwargs: Any) -> AsyncIterable["_models.RestorePointCollection"]: + """Gets the list of restore point collections in the subscription. Use nextLink property in the + response to get the next page of restore point collections. Do this till nextLink is not null + to fetch all the restore point collections. - :keyword expand: The expand expression to apply to the operation. Allowed values are - 'virtualMachines/$ref'. Default value is None. - :paramtype expand: str - :return: An iterator like instance of either AvailabilitySet or the result of cls(response) + :return: An iterator like instance of either RestorePointCollection or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollectionListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13933,9 +13967,8 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - _request = build_availability_sets_list_by_subscription_request( + _request = build_restore_point_collections_list_all_request( subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -13960,7 +13993,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -13984,21 +14017,23 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.AvailabilitySet"]: - """Lists all availability sets in a resource group. + def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.RestorePointCollection"]: + """Gets the list of restore point collections in a resource group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either AvailabilitySet or the result of cls(response) + :return: An iterator like instance of either RestorePointCollection or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollectionListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14011,7 +14046,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model def prepare_request(next_link=None): if not next_link: - _request = build_availability_sets_list_request( + _request = build_restore_point_collections_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -14038,7 +14073,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -14061,28 +14096,31 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list_available_sizes( - self, resource_group_name: str, availability_set_name: str, **kwargs: Any - ) -> AsyncIterable["_models.VirtualMachineSize"]: - """Lists all available virtual machine sizes that can be used to create a new virtual machine in - an existing availability set. + @distributed_trace_async + async def get( + self, + resource_group_name: str, + restore_point_collection_name: str, + *, + expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, + **kwargs: Any + ) -> _models.RestorePointCollection: + """The operation to get the restore point collection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :keyword expand: The expand expression to apply on the operation. If expand=restorePoints, + server will return all contained restore points in the restorePointCollection. "restorePoints" + Default value is None. + :paramtype expand: str or + ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionExpandOptions + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14091,140 +14129,123 @@ def list_available_sizes( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_availability_sets_list_available_sizes_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _request = build_restore_point_collections_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore @overload - async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.MigrateToVirtualMachineScaleSetInput, + restore_point_collection_name: str, + parameters: _models.RestorePointCollection, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. + ) -> _models.RestorePointCollection: + """The operation to create or update the restore point collection. Please refer to + https://aka.ms/RestorePoints for more details. When updating a restore point collection, only + tags may be modified. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def create_or_update( self, resource_group_name: str, - availability_set_name: str, + restore_point_collection_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. + ) -> _models.RestorePointCollection: + """The operation to create or update the restore point collection. Please refer to + https://aka.ms/RestorePoints for more details. When updating a restore point collection, only + tags may be modified. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, IO[bytes]], + restore_point_collection_name: str, + parameters: Union[_models.RestorePointCollection, IO[bytes]], **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. + ) -> _models.RestorePointCollection: + """The operation to create or update the restore point collection. Please refer to + https://aka.ms/RestorePoints for more details. When updating a restore point collection, only + tags may be modified. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is - either a MigrateToVirtualMachineScaleSetInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput - or IO[bytes] - :return: None or the result of cls(response) - :rtype: None + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Is either a RestorePointCollection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection or IO[bytes] + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14240,7 +14261,7 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14248,11 +14269,11 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "MigrateToVirtualMachineScaleSetInput") + _json = self._serialize.body(parameters, "RestorePointCollection") - _request = build_availability_sets_start_migration_to_virtual_machine_scale_set_request( + _request = build_restore_point_collections_create_or_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -14270,142 +14291,94 @@ async def start_migration_to_virtual_machine_scale_set( # pylint: disable=name- response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, resource_group_name: str, availability_set_name: str, **kwargs: Any - ) -> None: - """Cancel the migration operation on an Availability Set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload - async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.MigrateToVirtualMachineScaleSetInput, + restore_point_collection_name: str, + parameters: _models.RestorePointCollectionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def update( self, resource_group_name: str, - availability_set_name: str, + restore_point_collection_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + async def update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, IO[bytes]], + restore_point_collection_name: str, + parameters: Union[_models.RestorePointCollectionUpdate, IO[bytes]], **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is - either a MigrateToVirtualMachineScaleSetInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput - or IO[bytes] - :return: None or the result of cls(response) - :rtype: None + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. Is + either a RestorePointCollectionUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionUpdate or + IO[bytes] + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14421,7 +14394,7 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14429,11 +14402,11 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "MigrateToVirtualMachineScaleSetInput") + _json = self._serialize.body(parameters, "RestorePointCollectionUpdate") - _request = build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( + _request = build_restore_point_collections_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -14451,19 +14424,19 @@ async def validate_migration_to_virtual_machine_scale_set( # pylint: disable=na response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore - async def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14473,32 +14446,17 @@ async def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConvertToVirtualMachineScaleSetInput") - else: - _json = None - - _request = build_availability_sets_convert_to_virtual_machine_scale_set_request( + _request = build_restore_point_collections_delete_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -14512,7 +14470,7 @@ async def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name response = pipeline_response.http_response - if response.status_code not in [202]: + 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): @@ -14520,108 +14478,47 @@ async def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[_models.ConvertToVirtualMachineScaleSetInput] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ConvertToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. + async def begin_delete( + self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the restore point collection. This operation will also delete all the + contained restore points. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is - either a ConvertToVirtualMachineScaleSetInput type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ConvertToVirtualMachineScaleSetInput - or IO[bytes] + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._convert_to_virtual_machine_scale_set_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - parameters=parameters, + restore_point_collection_name=restore_point_collection_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -14635,7 +14532,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -14650,99 +14549,317 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore -class ProximityPlacementGroupsOperations: +class SshPublicKeysOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`proximity_placement_groups` attribute. + :attr:`ssh_public_keys` attribute. """ models = _models def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SshPublicKeyResource"]: + """Lists all of the SSH public keys in the subscription. Use the nextLink property in the response + to get the next page of SSH public keys. + + :return: An iterator like instance of either SshPublicKeyResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.SshPublicKeysGroupListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ssh_public_keys_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SshPublicKeyResource"]: + """Lists all of the SSH public keys in the specified resource group. Use the nextLink property in + the response to get the next page of SSH public keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either SshPublicKeyResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.SshPublicKeysGroupListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ssh_public_keys_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any + ) -> _models.SshPublicKeyResource: + """Retrieves information about an SSH public key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + + _request = build_ssh_public_keys_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload - async def create_or_update( + async def create( self, resource_group_name: str, - proximity_placement_group_name: str, - parameters: _models.ProximityPlacementGroup, + ssh_public_key_name: str, + parameters: _models.SshPublicKeyResource, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_or_update( + async def create( self, resource_group_name: str, - proximity_placement_group_name: str, + ssh_public_key_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_or_update( + async def create( self, resource_group_name: str, - proximity_placement_group_name: str, - parameters: Union[_models.ProximityPlacementGroup, IO[bytes]], + ssh_public_key_name: str, + parameters: Union[_models.SshPublicKeyResource, IO[bytes]], **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Is - either a ProximityPlacementGroup type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup or IO[bytes] - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Is either a + SshPublicKeyResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource or IO[bytes] + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14758,7 +14875,7 @@ async def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14766,11 +14883,11 @@ async def create_or_update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "ProximityPlacementGroup") + _json = self._serialize.body(parameters, "SshPublicKeyResource") - _request = build_proximity_placement_groups_create_or_update_request( + _request = build_ssh_public_keys_create_request( resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -14792,7 +14909,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14803,26 +14920,26 @@ async def create_or_update( async def update( self, resource_group_name: str, - proximity_placement_group_name: str, - parameters: _models.ProximityPlacementGroupUpdate, + ssh_public_key_name: str, + parameters: _models.SshPublicKeyUpdateResource, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroupUpdate + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyUpdateResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @@ -14830,26 +14947,26 @@ async def update( async def update( self, resource_group_name: str, - proximity_placement_group_name: str, + ssh_public_key_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @@ -14857,22 +14974,23 @@ async def update( async def update( self, resource_group_name: str, - proximity_placement_group_name: str, - parameters: Union[_models.ProximityPlacementGroupUpdate, IO[bytes]], + ssh_public_key_name: str, + parameters: Union[_models.SshPublicKeyUpdateResource, IO[bytes]], **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Is - either a ProximityPlacementGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroupUpdate or + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Is either a + SshPublicKeyUpdateResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyUpdateResource or IO[bytes] - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14888,7 +15006,7 @@ async def update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -14896,11 +15014,11 @@ async def update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "ProximityPlacementGroupUpdate") + _json = self._serialize.body(parameters, "SshPublicKeyUpdateResource") - _request = build_proximity_placement_groups_update_request( + _request = build_ssh_public_keys_update_request( resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -14922,7 +15040,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14930,13 +15048,14 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def delete(self, resource_group_name: str, proximity_placement_group_name: str, **kwargs: Any) -> None: - """Delete a proximity placement group. + async def delete(self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any) -> None: + """Delete an SSH public key. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -14955,9 +15074,9 @@ async def delete(self, resource_group_name: str, proximity_placement_group_name: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_proximity_placement_groups_delete_request( + _request = build_ssh_public_keys_delete_request( resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -14972,33 +15091,94 @@ async def delete(self, resource_group_name: str, proximity_placement_group_name: response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace_async - async def get( + @overload + async def generate_key_pair( self, resource_group_name: str, - proximity_placement_group_name: str, + ssh_public_key_name: str, + parameters: Optional[_models.SshGenerateKeyPairInputParameters] = None, *, - include_colocation_status: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Retrieves information about a proximity placement group . + ) -> _models.SshPublicKeyGenerateKeyPairResult: + """Generates and returns a public/private key pair and populates the SSH public key resource with + the public key. The length of the key will be 3072 bits. This operation can only be performed + once per SSH public key resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :keyword include_colocation_status: includeColocationStatus=true enables fetching the - colocation status of all the resources in the proximity placement group. Default value is None. - :paramtype include_colocation_status: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshGenerateKeyPairInputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyGenerateKeyPairResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyGenerateKeyPairResult: + """Generates and returns a public/private key pair and populates the SSH public key resource with + the public key. The length of the key will be 3072 bits. This operation can only be performed + once per SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyGenerateKeyPairResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Optional[Union[_models.SshGenerateKeyPairInputParameters, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.SshPublicKeyGenerateKeyPairResult: + """Generates and returns a public/private key pair and populates the SSH public key resource with + the public key. The length of the key will be 3072 bits. This operation can only be performed + once per SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Is either a + SshGenerateKeyPairInputParameters type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshGenerateKeyPairInputParameters or + IO[bytes] + :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyGenerateKeyPairResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -15009,18 +15189,32 @@ async def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SshPublicKeyGenerateKeyPairResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "SshGenerateKeyPairInputParameters") + else: + _json = None - _request = build_proximity_placement_groups_get_request( + _request = build_ssh_public_keys_generate_key_pair_request( resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, - include_colocation_status=include_colocation_status, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -15037,28 +15231,56 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyGenerateKeyPairResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + +class CapacityReservationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`capacity_reservations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ProximityPlacementGroup"]: - """Lists all proximity placement groups in a subscription. + def list_by_capacity_reservation_group( + self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CapacityReservation"]: + """Lists all of the capacity reservations in the specified capacity reservation group. Use the + nextLink property in the response to get the next page of capacity reservations. - :return: An iterator like instance of either ProximityPlacementGroup or the result of - cls(response) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :return: An iterator like instance of either CapacityReservation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ProximityPlacementGroupListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15071,7 +15293,9 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Proximit def prepare_request(next_link=None): if not next_link: - _request = build_proximity_placement_groups_list_by_subscription_request( + _request = build_capacity_reservations_list_by_capacity_reservation_group_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -15097,7 +15321,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) + deserialized = self._deserialize("CapacityReservationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -15120,26 +15344,34 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ProximityPlacementGroup"]: - """Lists all proximity placement groups in a resource group. + @distributed_trace_async + async def get( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + *, + expand: Optional[Union[str, _models.CapacityReservationInstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.CapacityReservation: + """The operation that retrieves information about the capacity reservation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either ProximityPlacementGroup or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves a + snapshot of the runtime properties of the capacity reservation that is managed by the platform + and can change outside of control plane operations. "instanceView" Default value is None. + :paramtype expand: str or + ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationInstanceViewTypes + :return: CapacityReservation or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservation :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ProximityPlacementGroupListResult] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15148,159 +15380,50 @@ def list_by_resource_group( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_proximity_placement_groups_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -class DedicatedHostGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`dedicated_host_groups` attribute. - """ + _request = build_capacity_reservations_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - models = _models + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + response = pipeline_response.http_response - @overload - async def create_or_update( - self, - resource_group_name: str, - host_group_name: str, - parameters: _models.DedicatedHostGroup, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host - Groups please see [Dedicated Host Documentation] - (https://go.microsoft.com/fwlink/?linkid=2082596). + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) - @overload - async def create_or_update( - self, - resource_group_name: str, - host_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host - Groups please see [Dedicated Host Documentation] - (https://go.microsoft.com/fwlink/?linkid=2082596). + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore - @distributed_trace_async - async def create_or_update( + async def _create_or_update_initial( self, resource_group_name: str, - host_group_name: str, - parameters: Union[_models.DedicatedHostGroup, IO[bytes]], + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservation, IO[bytes]], **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host - Groups please see [Dedicated Host Documentation] - (https://go.microsoft.com/fwlink/?linkid=2082596). - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Is either a - DedicatedHostGroup type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup or IO[bytes] - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15314,7 +15437,7 @@ async def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15322,11 +15445,12 @@ async def create_or_update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "DedicatedHostGroup") + _json = self._serialize.body(parameters, "CapacityReservation") - _request = build_dedicated_host_groups_create_or_update_request( + _request = build_capacity_reservations_create_or_update_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -15337,7 +15461,8 @@ async def create_or_update( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -15345,89 +15470,180 @@ async def create_or_update( 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def update( + async def begin_create_or_update( self, resource_group_name: str, - host_group_name: str, - parameters: _models.DedicatedHostGroupUpdate, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: _models.CapacityReservation, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> AsyncLROPoller[_models.CapacityReservation]: + """The operation to create or update a capacity reservation. Please note some properties can be + set only during capacity reservation creation. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroupUpdate + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservation :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup + :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def begin_create_or_update( self, resource_group_name: str, - host_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> AsyncLROPoller[_models.CapacityReservation]: + """The operation to create or update a capacity reservation. Please note some properties can be + set only during capacity reservation creation. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup + :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( + async def begin_create_or_update( self, resource_group_name: str, - host_group_name: str, - parameters: Union[_models.DedicatedHostGroupUpdate, IO[bytes]], + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservation, IO[bytes]], **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> AsyncLROPoller[_models.CapacityReservation]: + """The operation to create or update a capacity reservation. Please note some properties can be + set only during capacity reservation creation. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Is either - a DedicatedHostGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroupUpdate or IO[bytes] - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Is either a + CapacityReservation type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservation or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CapacityReservation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CapacityReservation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservationUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15441,7 +15657,7 @@ async def update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -15449,11 +15665,12 @@ async def update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "DedicatedHostGroupUpdate") + _json = self._serialize.body(parameters, "CapacityReservationUpdate") - _request = build_dedicated_host_groups_update_request( + _request = build_capacity_reservations_update_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -15464,98 +15681,182 @@ async def update( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + async def begin_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: _models.CapacityReservationUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def delete(self, resource_group_name: str, host_group_name: str, **kwargs: Any) -> None: - """Delete a dedicated host group. + async def begin_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservationUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :return: None or the result of cls(response) - :rtype: None + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Is either + a CapacityReservationUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - _request = build_dedicated_host_groups_delete_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CapacityReservation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CapacityReservation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( + async def _delete_initial( self, resource_group_name: str, - host_group_name: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + capacity_reservation_group_name: str, + capacity_reservation_name: str, **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Retrieves information about a dedicated host group. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve - the list of instance views of the dedicated hosts under the dedicated host group. 'UserData' is - not supported for dedicated host group. Known values are: "instanceView", "userData", and - "resiliencyView". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15568,133 +15869,156 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_dedicated_host_groups_get_request( + _request = build_capacity_reservations_delete_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DedicatedHostGroup"]: - """Lists all of the dedicated host groups in the specified resource group. Use the nextLink - property in the response to get the next page of dedicated host groups. + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete a capacity reservation. This operation is allowed only when all the + associated resources are disassociated from the capacity reservation. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either DedicatedHostGroup or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.DedicatedHostGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_dedicated_host_groups_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - async def extract_data(pipeline_response): - deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) - list_of_elem = deserialized.value + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def get_next(next_link=None): - _request = prepare_request(next_link) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response +class DedicatedHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`dedicated_hosts` attribute. + """ - return pipeline_response + models = _models - return AsyncItemPaged(get_next, extract_data) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DedicatedHostGroup"]: - """Lists all of the dedicated host groups in the subscription. Use the nextLink property in the - response to get the next page of dedicated host groups. + def list_by_host_group( + self, resource_group_name: str, host_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DedicatedHost"]: + """Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink + property in the response to get the next page of dedicated hosts. - :return: An iterator like instance of either DedicatedHostGroup or the result of cls(response) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :return: An iterator like instance of either DedicatedHost or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.DedicatedHostGroupListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15707,7 +16031,9 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Dedicate def prepare_request(next_link=None): if not next_link: - _request = build_dedicated_host_groups_list_by_subscription_request( + _request = build_dedicated_hosts_list_by_host_group_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -15733,7 +16059,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -15756,26 +16082,77 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + @distributed_trace_async + async def get( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.DedicatedHost: + """Retrieves information about a dedicated host. -class DedicatedHostsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve + the list of instance views of the dedicated host. 'UserData' is not supported for dedicated + host. Known values are: "instanceView", "userData", and "resiliencyView". Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes + :return: DedicatedHost or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`dedicated_hosts` attribute. - """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - models = _models + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + _request = build_dedicated_hosts_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DedicatedHost", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -15838,10 +16215,15 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -15858,11 +16240,12 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.DedicatedHost]: """Create or update a dedicated host . - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param host_name: The name of the dedicated host . Required. + :param host_name: The name of the dedicated host. Required. :type host_name: str :param parameters: Parameters supplied to the Create Dedicated Host. Required. :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHost @@ -15889,11 +16272,12 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.DedicatedHost]: """Create or update a dedicated host . - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param host_name: The name of the dedicated host . Required. + :param host_name: The name of the dedicated host. Required. :type host_name: str :param parameters: Parameters supplied to the Create Dedicated Host. Required. :type parameters: IO[bytes] @@ -15918,11 +16302,12 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.DedicatedHost]: """Create or update a dedicated host . - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param host_name: The name of the dedicated host . Required. + :param host_name: The name of the dedicated host. Required. :type host_name: str :param parameters: Parameters supplied to the Create Dedicated Host. Is either a DedicatedHost type or a IO[bytes] type. Required. @@ -15965,7 +16350,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -16042,10 +16429,14 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -16062,11 +16453,12 @@ async def begin_update( ) -> AsyncLROPoller[_models.DedicatedHost]: """Update a dedicated host . - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param host_name: The name of the dedicated host . Required. + :param host_name: The name of the dedicated host. Required. :type host_name: str :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostUpdate @@ -16093,11 +16485,12 @@ async def begin_update( ) -> AsyncLROPoller[_models.DedicatedHost]: """Update a dedicated host . - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param host_name: The name of the dedicated host . Required. + :param host_name: The name of the dedicated host. Required. :type host_name: str :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. :type parameters: IO[bytes] @@ -16122,11 +16515,12 @@ async def begin_update( ) -> AsyncLROPoller[_models.DedicatedHost]: """Update a dedicated host . - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param host_name: The name of the dedicated host . Required. + :param host_name: The name of the dedicated host. Required. :type host_name: str :param parameters: Parameters supplied to the Update Dedicated Host operation. Is either a DedicatedHostUpdate type or a IO[bytes] type. Required. @@ -16163,13 +16557,20 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("DedicatedHost", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -16229,10 +16630,15 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -16242,7 +16648,8 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Delete a dedicated host. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str @@ -16266,125 +16673,59 @@ async def begin_delete( host_group_name=host_group_name, host_name=host_name, api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any - ) -> _models.DedicatedHost: - """Retrieves information about a dedicated host. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve - the list of instance views of the dedicated host. 'UserData' is not supported for dedicated - host. Known values are: "instanceView", "userData", and "resiliencyView". Default value is - None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes - :return: DedicatedHost or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHost - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) - - _request = build_dedicated_hosts_get_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DedicatedHost", pipeline_response.http_response) + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - return deserialized # type: ignore + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_host_group( - self, resource_group_name: str, host_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DedicatedHost"]: - """Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink - property in the response to get the next page of dedicated hosts. + def list_available_sizes( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> AsyncIterable[str]: + """Lists all available dedicated host sizes to which the specified dedicated host can be resized. + NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated + host. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :return: An iterator like instance of either DedicatedHost or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.DedicatedHost] + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An iterator like instance of either str or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[str] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.DedicatedHostListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostSizeListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16397,9 +16738,10 @@ def list_by_host_group( def prepare_request(next_link=None): if not next_link: - _request = build_dedicated_hosts_list_by_host_group_request( + _request = build_dedicated_hosts_list_available_sizes_request( resource_group_name=resource_group_name, host_group_name=host_group_name, + host_name=host_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -16425,7 +16767,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) + deserialized = self._deserialize("DedicatedHostSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -16448,6 +16790,125 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + async def _redeploy_initial( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_dedicated_hosts_redeploy_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_redeploy( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Redeploy the dedicated host. The operation will complete successfully once the dedicated host + has migrated to a new node and is running. To determine the health of VMs deployed on the + dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please + refer to https://docs.microsoft.com/azure/service-health/resource-health-overview for more + details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + async def _restart_initial( self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: @@ -16492,10 +16953,14 @@ async def _restart_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -16508,7 +16973,8 @@ async def begin_restart( after the restart check the Resource Health Center in the Azure Portal. Please refer to https://docs.microsoft.com/azure/service-health/resource-health-overview for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str @@ -16545,7 +17011,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -16559,8 +17027,104 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _redeploy_initial( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + +class RestorePointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`restore_points` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + *, + expand: Optional[Union[str, _models.RestorePointExpandOptions]] = None, + **kwargs: Any + ) -> _models.RestorePoint: + """The operation to get the restore point. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves + information about the run-time state of a restore point. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.RestorePointExpandOptions + :return: RestorePoint or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + + _request = build_restore_points_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RestorePoint", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: Union[_models.RestorePoint, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16570,18 +17134,30 @@ async def _redeploy_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_dedicated_hosts_redeploy_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RestorePoint") + + _request = build_restore_points_create_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -16595,7 +17171,7 @@ async def _redeploy_initial( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -16605,6 +17181,7 @@ async def _redeploy_initial( response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -16613,192 +17190,155 @@ async def _redeploy_initial( return deserialized # type: ignore - @distributed_trace_async - async def begin_redeploy( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Redeploy the dedicated host. The operation will complete successfully once the dedicated host - has migrated to a new node and is running. To determine the health of VMs deployed on the - dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please - refer to https://docs.microsoft.com/azure/service-health/resource-health-overview for more - details. + @overload + async def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: _models.RestorePoint, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RestorePoint]: + """The operation to create the restore point. Updating properties of an existing restore point is + not allowed. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RestorePoint] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._redeploy_initial( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def list_available_sizes( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> AsyncIterable[str]: - """Lists all available dedicated host sizes to which the specified dedicated host can be resized. - NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated - host. + @overload + async def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RestorePoint]: + """The operation to create the restore point. Updating properties of an existing restore point is + not allowed. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An iterator like instance of either str or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[str] + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RestorePoint] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.DedicatedHostSizeListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_dedicated_hosts_list_available_sizes_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DedicatedHostSizeListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class SshPublicKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`ssh_public_keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SshPublicKeyResource"]: - """Lists all of the SSH public keys in the subscription. Use the nextLink property in the response - to get the next page of SSH public keys. + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: Union[_models.RestorePoint, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.RestorePoint]: + """The operation to create the restore point. Updating properties of an existing restore point is + not allowed. - :return: An iterator like instance of either SshPublicKeyResource or the result of + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Is either a + RestorePoint type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePoint or IO[bytes] + :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RestorePoint] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.SshPublicKeysGroupListResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("RestorePoint", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.RestorePoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RestorePoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + async def _delete_initial( + self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16807,213 +17347,135 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SshPubli } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_ssh_public_keys_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _request = build_restore_points_delete_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - async def extract_data(pipeline_response): - deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200, 202, 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return pipeline_response + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SshPublicKeyResource"]: - """Lists all of the SSH public keys in the specified resource group. Use the nextLink property in - the response to get the next page of SSH public keys. + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the restore point. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either SshPublicKeyResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource] + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.SshPublicKeysGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_ssh_public_keys_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - async def extract_data(pipeline_response): - deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) - list_of_elem = deserialized.value + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) + return cls(pipeline_response, None, {}) # type: ignore - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @overload - async def create( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: _models.SshPublicKeyResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ +class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. - @overload - async def create( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`virtual_machine_scale_set_rolling_upgrades` attribute. + """ - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + models = _models - @distributed_trace_async - async def create( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Union[_models.SshPublicKeyResource, IO[bytes]], - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Is either a - SshPublicKeyResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource or IO[bytes] - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _start_extension_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17022,192 +17484,226 @@ async def create( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SshPublicKeyResource") + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_ssh_public_keys_create_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: _models.SshPublicKeyUpdateResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. + @distributed_trace_async + async def begin_start_extension_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to + the latest available extension version. Instances which are already running the latest + extension versions are not affected. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyUpdateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @overload - async def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_extension_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace_async - async def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Union[_models.SshPublicKeyUpdateResource, IO[bytes]], - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Is either a - SshPublicKeyUpdateResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyUpdateResource or - IO[bytes] - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _start_os_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SshPublicKeyUpdateResource") + error_map.update(kwargs.pop("error_map", {}) or {}) - _request = build_ssh_public_keys_update_request( + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def delete(self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any) -> None: - """Delete an SSH public key. + async def begin_start_os_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts a rolling upgrade to move all virtual machine scale set instances to the latest + available Platform Image OS version. Instances which are already running the latest available + OS version are not affected. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :return: None or the result of cls(response) - :rtype: None + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_os_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _cancel_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17220,11 +17716,11 @@ async def delete(self, resource_group_name: str, ssh_public_key_name: str, **kwa _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_ssh_public_keys_delete_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_cancel_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -17232,32 +17728,104 @@ async def delete(self, resource_group_name: str, ssh_public_key_name: str, **kwa ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async - async def get( - self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Retrieves information about an SSH public key. + async def begin_cancel( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Cancels the current virtual machine scale set rolling upgrade. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._cancel_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get_latest( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> _models.RollingUpgradeStatusInfo: + """Gets the status of the latest virtual machine scale set rolling upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: RollingUpgradeStatusInfo or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RollingUpgradeStatusInfo :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17272,11 +17840,11 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + cls: ClsType[_models.RollingUpgradeStatusInfo] = kwargs.pop("cls", None) - _request = build_ssh_public_keys_get_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -17289,97 +17857,148 @@ async def get( _request, stream=_stream, **kwargs ) - response = pipeline_response.http_response + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RollingUpgradeStatusInfo", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`virtual_machine_scale_set_extensions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineScaleSetExtension"]: + """Gets a list of all extensions in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An iterator like instance of either VirtualMachineScaleSetExtension or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetExtensionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _request = build_virtual_machine_scale_set_extensions_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) - return deserialized # type: ignore + async def get_next(next_link=None): + _request = prepare_request(next_link) - @overload - async def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[_models.SshGenerateKeyPairInputParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyGenerateKeyPairResult: - """Generates and returns a public/private key pair and populates the SSH public key resource with - the public key. The length of the key will be 3072 bits. This operation can only be performed - once per SSH public key resource. + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshGenerateKeyPairInputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - @overload - async def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyGenerateKeyPairResult: - """Generates and returns a public/private key pair and populates the SSH public key resource with - the public key. The length of the key will be 3072 bits. This operation can only be performed - once per SSH public key resource. + return pipeline_response - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def generate_key_pair( + async def get( self, resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[Union[_models.SshGenerateKeyPairInputParameters, IO[bytes]]] = None, + vm_scale_set_name: str, + vmss_extension_name: str, + *, + expand: Optional[str] = None, **kwargs: Any - ) -> _models.SshPublicKeyGenerateKeyPairResult: - """Generates and returns a public/private key pair and populates the SSH public key resource with - the public key. The length of the key will be 3072 bits. This operation can only be performed - once per SSH public key resource. + ) -> _models.VirtualMachineScaleSetExtension: + """The operation to get the extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Is either a - SshGenerateKeyPairInputParameters type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshGenerateKeyPairInputParameters or - IO[bytes] - :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyGenerateKeyPairResult + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetExtension or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17390,32 +18009,19 @@ async def generate_key_pair( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyGenerateKeyPairResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "SshGenerateKeyPairInputParameters") - else: - _json = None + cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) - _request = build_ssh_public_keys_generate_key_pair_request( + _request = build_virtual_machine_scale_set_extensions_get_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -17432,36 +18038,20 @@ async def generate_key_pair( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SshPublicKeyGenerateKeyPairResult", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - -class ImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - async def _create_or_update_initial( - self, resource_group_name: str, image_name: str, parameters: Union[_models.Image, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetExtension, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17481,14 +18071,15 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _json = self._serialize.body(parameters, "Image") + _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetExtension") - _request = build_images_create_or_update_request( + _request = build_virtual_machine_scale_set_extensions_create_or_update_request( resource_group_name=resource_group_name, - image_name=image_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -17515,10 +18106,15 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -17526,25 +18122,33 @@ async def _create_or_update_initial( async def begin_create_or_update( self, resource_group_name: str, - image_name: str, - parameters: _models.Image, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: _models.VirtualMachineScaleSetExtension, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - """Create or update an image. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: + """The operation to create or update an extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.Image + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -17552,43 +18156,61 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - image_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - """Create or update an image. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: + """The operation to create or update an extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. - :type parameters: IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, image_name: str, parameters: Union[_models.Image, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - """Create or update an image. + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetExtension, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: + """The operation to create or update an extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Is either a Image type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.Image or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Is either a VirtualMachineScaleSetExtension type or a IO[bytes] type. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension or IO[bytes] + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -17596,15 +18218,16 @@ async def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - image_name=image_name, - parameters=parameters, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + extension_parameters=extension_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -17616,33 +18239,36 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Image", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Image].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Image]( + return AsyncLROPoller[_models.VirtualMachineScaleSetExtension]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) async def _update_initial( self, resource_group_name: str, - image_name: str, - parameters: Union[_models.ImageUpdate, IO[bytes]], + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -17663,14 +18289,15 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _json = self._serialize.body(parameters, "ImageUpdate") + _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetExtensionUpdate") - _request = build_images_update_request( + _request = build_virtual_machine_scale_set_extensions_update_request( resource_group_name=resource_group_name, - image_name=image_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -17697,10 +18324,15 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -17708,25 +18340,33 @@ async def _update_initial( async def begin_update( self, resource_group_name: str, - image_name: str, - parameters: _models.ImageUpdate, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: _models.VirtualMachineScaleSetExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - """Update an image. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: + """The operation to update an extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ImageUpdate + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -17734,25 +18374,32 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - image_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - """Update an image. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: + """The operation to update an extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. - :type parameters: IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -17760,21 +18407,29 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - image_name: str, - parameters: Union[_models.ImageUpdate, IO[bytes]], + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Image]: - """Update an image. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetExtension]: + """The operation to update an extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Is either a ImageUpdate - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ImageUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Is either a VirtualMachineScaleSetExtensionUpdate type or a IO[bytes] type. + Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtensionUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetExtension or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -17782,15 +18437,16 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - image_name=image_name, - parameters=parameters, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + extension_parameters=extension_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -17802,29 +18458,33 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Image", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Image].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Image]( + return AsyncLROPoller[_models.VirtualMachineScaleSetExtension]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + async def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17839,9 +18499,10 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_images_delete_request( + _request = build_virtual_machine_scale_set_extensions_delete_request( resource_group_name=resource_group_name, - image_name=image_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -17865,21 +18526,31 @@ async def _delete_initial(self, resource_group_name: str, image_name: str, **kwa map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_delete(self, resource_group_name: str, image_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes an Image. + async def begin_delete( + self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -17895,7 +18566,8 @@ async def begin_delete(self, resource_group_name: str, image_name: str, **kwargs if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, - image_name=image_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -17910,95 +18582,82 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, image_name: str, *, expand: Optional[str] = None, **kwargs: Any - ) -> _models.Image: - """Gets an image. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: Image or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.Image - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) - - _request = build_images_get_request( - resource_group_name=resource_group_name, - image_name=image_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) +class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - deserialized = self._deserialize("Image", pipeline_response.http_response) + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`virtual_machine_scale_set_vms` attribute. + """ - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + models = _models - return deserialized # type: ignore + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Image"]: - """Gets the list of images under a resource group. Use nextLink property in the response to get - the next page of Images. Do this till nextLink is null to fetch all the Images. + def list( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineScaleSetVM"]: + """Gets a list of all virtual machines in a VM scale sets. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either Image or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.Image] + :param virtual_machine_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type virtual_machine_scale_set_name: str + :keyword filter: The filter to apply to the operation. Allowed values are + 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied + eq true', 'properties/latestModelApplied eq false'. Default value is None. + :paramtype filter: str + :keyword select: The list parameters. Allowed values are 'instanceView', + 'instanceView/statuses'. Default value is None. + :paramtype select: str + :keyword expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. Default value is None. + :paramtype expand: str + :return: An iterator like instance of either VirtualMachineScaleSetVM or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ImageListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -18011,9 +18670,13 @@ 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_images_list_by_resource_group_request( + _request = build_virtual_machine_scale_set_vms_list_request( resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -18038,7 +18701,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("ImageListResult", pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -18061,21 +18724,34 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Image"]: - """Gets the list of Images in the subscription. Use nextLink property in the response to get the - next page of Images. Do this till nextLink is null to fetch all the Images. + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.VirtualMachineScaleSetVM: + """Gets a virtual machine from a VM scale set. - :return: An iterator like instance of either Image or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.Image] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve + the instance view of the virtual machine. 'UserData' will retrieve the UserData of the virtual + machine. Known values are: "instanceView", "userData", and "resiliencyView". Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes + :return: VirtualMachineScaleSetVM or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ImageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18084,160 +18760,53 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Image"]: } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_images_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ImageListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - return AsyncItemPaged(get_next, extract_data) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) + _request = build_virtual_machine_scale_set_vms_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) -class RestorePointCollectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`restore_point_collections` attribute. - """ + response = pipeline_response.http_response - models = _models + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + deserialized = self._deserialize("VirtualMachineScaleSetVM", pipeline_response.http_response) - @overload - async def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: _models.RestorePointCollection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to create or update the restore point collection. Please refer to - https://aka.ms/RestorePoints for more details. When updating a restore point collection, only - tags may be modified. + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore - @overload - async def create_or_update( + async def _update_initial( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.VirtualMachineScaleSetVM, IO[bytes]], *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to create or update the restore point collection. Please refer to - https://aka.ms/RestorePoints for more details. When updating a restore point collection, only - tags may be modified. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: Union[_models.RestorePointCollection, IO[bytes]], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to create or update the restore point collection. Please refer to - https://aka.ms/RestorePoints for more details. When updating a restore point collection, only - tags may be modified. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Is either a RestorePointCollection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection or IO[bytes] - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18251,7 +18820,7 @@ async def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -18259,12 +18828,15 @@ async def create_or_update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "RestorePointCollection") + _json = self._serialize.body(parameters, "VirtualMachineScaleSetVM") - _request = build_restore_point_collections_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, content_type=content_type, json=_json, @@ -18274,156 +18846,218 @@ async def create_or_update( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def update( + async def begin_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: _models.RestorePointCollectionUpdate, + vm_scale_set_name: str, + instance_id: str, + parameters: _models.VirtualMachineScaleSetVM, *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionUpdate + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def begin_update( self, resource_group_name: str, - restore_point_collection_name: str, + vm_scale_set_name: str, + instance_id: str, parameters: IO[bytes], *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. :type parameters: IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( + async def begin_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: Union[_models.RestorePointCollectionUpdate, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.VirtualMachineScaleSetVM, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. Is - either a RestorePointCollectionUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionUpdate or - IO[bytes] - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Is either a VirtualMachineScaleSetVM type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM or IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVM or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RestorePointCollectionUpdate") + cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - _request = build_restore_point_collections_update_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetVM", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.VirtualMachineScaleSetVM].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VirtualMachineScaleSetVM]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - async def _delete_initial( - self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -18439,10 +19073,12 @@ async def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_restore_point_collections_delete_request( + _request = build_virtual_machine_scale_set_vms_delete_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, + force_deletion=force_deletion, api_version=api_version, headers=_headers, params=_params, @@ -18465,24 +19101,40 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async async def begin_delete( - self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to delete the restore point collection. This operation will also delete all the - contained restore points. + """Deletes a virtual machine from a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the Restore Point Collection. Required. - :type restore_point_collection_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword force_deletion: Optional parameter to force delete a virtual machine from a VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -18498,7 +19150,9 @@ async def begin_delete( if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + force_deletion=force_deletion, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -18513,7 +19167,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -18527,30 +19183,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace_async - async def get( - self, - resource_group_name: str, - restore_point_collection_name: str, - *, - expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to get the restore point collection. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :keyword expand: The expand expression to apply on the operation. If expand=restorePoints, - server will return all contained restore points in the restorePointCollection. "restorePoints" - Default value is None. - :paramtype expand: str or - ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionExpandOptions - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _approve_rolling_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18563,221 +19198,112 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_restore_point_collections_get_request( + _request = build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.RestorePointCollection"]: - """Gets the list of restore point collections in a resource group. + @distributed_trace_async + async def begin_approve_rolling_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either RestorePointCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RestorePointCollectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_restore_point_collections_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_all(self, **kwargs: Any) -> AsyncIterable["_models.RestorePointCollection"]: - """Gets the list of restore point collections in the subscription. Use nextLink property in the - response to get the next page of restore point collections. Do this till nextLink is not null - to fetch all the restore point collections. - - :return: An iterator like instance of either RestorePointCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RestorePointCollectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_restore_point_collections_list_all_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class RestorePointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`restore_points` attribute. - """ + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._approve_rolling_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - models = _models + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _create_initial( + async def _attach_detach_data_disks_initial( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: Union[_models.RestorePoint, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -18801,12 +19327,12 @@ async def _create_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "RestorePoint") + _json = self._serialize.body(parameters, "AttachDetachDataDisksRequest") - _request = build_restore_points_create_request( + _request = build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -18825,7 +19351,7 @@ async def _create_initial( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -18833,118 +19359,252 @@ async def _create_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_create( + async def begin_attach_detach_data_disks( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: _models.RestorePoint, + vm_scale_set_name: str, + instance_id: str, + parameters: _models.AttachDetachDataDisksRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.RestorePoint]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePoint + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of + :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RestorePoint] + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Is either a AttachDetachDataDisksRequest type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either StorageProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._attach_detach_data_disks_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("StorageProfile", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.StorageProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.StorageProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _deallocate_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_deallocate_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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=_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - @overload - async def begin_create( - self, - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.RestorePoint]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: - """ + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: Union[_models.RestorePoint, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.RestorePoint]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + async def begin_deallocate( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and + releases the compute resources it uses. You are not billed for the compute resources of this + virtual machine once it is deallocated. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Is either a - RestorePoint type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePoint or IO[bytes] - :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RestorePoint] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, - parameters=parameters, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -18953,31 +19613,89 @@ async def begin_create( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RestorePoint", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.RestorePoint].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.RestorePoint]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get_instance_view( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> _models.VirtualMachineScaleSetVMInstanceView: + """Gets the status of a virtual machine from a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: VirtualMachineScaleSetVMInstanceView or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetVMInstanceView] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, ) + _request.url = self._client.format_url(_request.url) - async def _delete_initial( - self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualMachineScaleSetVMInstanceView", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _perform_maintenance_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -18993,10 +19711,10 @@ async def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_restore_points_delete_request( + _request = build_virtual_machine_scale_set_vms_perform_maintenance_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -19012,7 +19730,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -19020,25 +19738,31 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + async def begin_perform_maintenance( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to delete the restore point. + """Performs maintenance on a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the Restore Point Collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -19052,10 +19776,10 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._perform_maintenance_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -19070,7 +19794,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -19084,31 +19810,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace_async - async def get( + async def _power_off_initial( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, + vm_scale_set_name: str, + instance_id: str, *, - expand: Optional[Union[str, _models.RestorePointExpandOptions]] = None, + skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> _models.RestorePoint: - """The operation to get the restore point. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves - information about the run-time state of a restore point. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.RestorePointExpandOptions - :return: RestorePoint or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePoint - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19121,138 +19831,124 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_restore_points_get_request( + _request = build_virtual_machine_scale_set_vms_power_off_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - expand=expand, + skip_shutdown=skip_shutdown, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestorePoint", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class CapacityReservationGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`capacity_reservation_groups` attribute. - """ + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - models = _models + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + return deserialized # type: ignore - @overload - async def create_or_update( + @distributed_trace_async + async def begin_power_off( self, resource_group_name: str, - capacity_reservation_group_name: str, - parameters: _models.CapacityReservationGroup, + vm_scale_set_name: str, + instance_id: str, *, - content_type: str = "application/json", + skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - https://aka.ms/CapacityReservation for more details. + ) -> AsyncLROPoller[None]: + """Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached + and you are getting charged for the resources. Instead, use deallocate to release resources and + avoid charges. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. Default value is None. + :paramtype skip_shutdown: bool + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @overload - async def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - https://aka.ms/CapacityReservation for more details. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + skip_shutdown=skip_shutdown, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: Union[_models.CapacityReservationGroup, IO[bytes]], - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - https://aka.ms/CapacityReservation for more details. + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Is either a - CapacityReservationGroup type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup or IO[bytes] - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _redeploy_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19261,131 +19957,122 @@ async def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CapacityReservationGroup") + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_capacity_reservation_groups_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_redeploy_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: _models.CapacityReservationGroupUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. + @distributed_trace_async + async def begin_redeploy( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and + powers it back on. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroupUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - @distributed_trace_async - async def update( + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _reimage_initial( self, resource_group_name: str, - capacity_reservation_group_name: str, - parameters: Union[_models.CapacityReservationGroupUpdate, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetVMReimageParameters, IO[bytes]] + ] = None, **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. Is - either a CapacityReservationGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroupUpdate or - IO[bytes] - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19399,19 +20086,23 @@ async def update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservationGroup] = 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(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(vm_scale_set_vm_reimage_input, (IOBase, bytes)): + _content = vm_scale_set_vm_reimage_input else: - _json = self._serialize.body(parameters, "CapacityReservationGroupUpdate") + if vm_scale_set_vm_reimage_input is not None: + _json = self._serialize.body(vm_scale_set_vm_reimage_input, "VirtualMachineScaleSetVMReimageParameters") + else: + _json = None - _request = build_capacity_reservation_groups_update_request( + _request = build_virtual_machine_scale_set_vms_reimage_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -19422,103 +20113,175 @@ async def update( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def delete(self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any) -> None: - """The operation to delete a capacity reservation group. This operation is allowed only if all the - associated resources are disassociated from the reservation group and all capacity reservations - under the reservation group have also been deleted. Please refer to - https://aka.ms/CapacityReservation for more details. + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[_models.VirtualMachineScaleSetVMReimageParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :return: None or the result of cls(response) - :rtype: None + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + Default value is None. + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMReimageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_capacity_reservation_groups_delete_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + @overload + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. - if cls: - return cls(pipeline_response, None, {}) # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + Default value is None. + :type vm_scale_set_vm_reimage_input: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def get( + async def begin_reimage( self, resource_group_name: str, - capacity_reservation_group_name: str, - *, - expand: Optional[Union[str, _models.CapacityReservationGroupInstanceViewTypes]] = None, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetVMReimageParameters, IO[bytes]] + ] = None, **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation that retrieves information about a capacity reservation group. + ) -> AsyncLROPoller[None]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve - the list of instance views of the capacity reservations under the capacity reservation group - which is a snapshot of the runtime properties of a capacity reservation that is managed by the - platform and can change outside of control plane operations. "instanceView" Default value is - None. - :paramtype expand: str or - ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroupInstanceViewTypes - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + Is either a VirtualMachineScaleSetVMReimageParameters type or a IO[bytes] type. Default value + is None. + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMReimageParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _reimage_all_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19531,258 +20294,110 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_capacity_reservation_groups_get_request( + _request = build_virtual_machine_scale_set_vms_reimage_all_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CapacityReservationGroup"]: - """Lists all of the capacity reservation groups in the specified resource group. Use the nextLink - property in the response to get the next page of capacity reservation groups. + @distributed_trace_async + async def begin_reimage_all( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. + This operation is only supported for managed disks. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :keyword expand: The expand expression to apply on the operation. Based on the expand param(s) - specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are - associated to capacity reservation group in the response. Known values are: - "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. - :paramtype expand: str or - ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForGetCapacityReservationGroups - :return: An iterator like instance of either CapacityReservationGroup or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.CapacityReservationGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_capacity_reservation_groups_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription( - self, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, - **kwargs: Any - ) -> AsyncIterable["_models.CapacityReservationGroup"]: - """Lists all of the capacity reservation groups in the subscription. Use the nextLink property in - the response to get the next page of capacity reservation groups. - - :keyword expand: The expand expression to apply on the operation. Based on the expand param(s) - specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are - associated to capacity reservation group in the response. Known values are: - "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. - :paramtype expand: str or - ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForGetCapacityReservationGroups - :keyword resource_ids_only: The query option to fetch Capacity Reservation Group Resource Ids. - :code:`
    ` 'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation - group resources created in the subscription. :code:`
    ` 'SharedWithSubscription' enables - fetching Resource Ids for all capacity reservation group resources shared with the - subscription. :code:`
    ` 'All' enables fetching Resource Ids for all capacity reservation - group resources shared with the subscription and created in the subscription. Known values are: - "CreatedInSubscription", "SharedWithSubscription", and "All". Default value is None. - :paramtype resource_ids_only: str or - ~azure.mgmt.compute.v2024_11_01.models.ResourceIdOptionsForGetCapacityReservationGroups - :return: An iterator like instance of either CapacityReservationGroup or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.CapacityReservationGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_capacity_reservation_groups_list_by_subscription_request( - subscription_id=self._config.subscription_id, - expand=expand, - resource_ids_only=resource_ids_only, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class CapacityReservationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`capacity_reservations` attribute. - """ + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - models = _models + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _create_or_update_initial( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservation, IO[bytes]], - **kwargs: Any + async def _restart_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -19792,30 +20407,18 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CapacityReservation") - - _request = build_capacity_reservations_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_restart_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -19829,7 +20432,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -19837,124 +20440,49 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: _models.CapacityReservation, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CapacityReservation]: - """The operation to create or update a capacity reservation. Please note some properties can be - set only during capacity reservation creation. Please refer to - https://aka.ms/CapacityReservation for more details. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservation - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CapacityReservation]: - """The operation to create or update a capacity reservation. Please note some properties can be - set only during capacity reservation creation. Please refer to - https://aka.ms/CapacityReservation for more details. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservation, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CapacityReservation]: - """The operation to create or update a capacity reservation. Please note some properties can be - set only during capacity reservation creation. Please refer to - https://aka.ms/CapacityReservation for more details. + async def begin_restart( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Is either a - CapacityReservation type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservation or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._restart_initial( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, - parameters=parameters, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -19963,35 +20491,105 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.CapacityReservation].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.CapacityReservation]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def retrieve_boot_diagnostics_data( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> _models.RetrieveBootDiagnosticsDataResult: + """The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale + set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs + with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated + with a default expiration duration of 120 minutes. Default value is None. + :paramtype sas_uri_expiration_time_in_minutes: int + :return: RetrieveBootDiagnosticsDataResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RetrieveBootDiagnosticsDataResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - async def _update_initial( + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RetrieveBootDiagnosticsDataResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _run_command_initial( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservationUpdate, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.RunCommandInput, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -20015,12 +20613,12 @@ async def _update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "CapacityReservationUpdate") + _json = self._serialize.body(parameters, "RunCommandInput") - _request = build_capacity_reservations_update_request( + _request = build_virtual_machine_scale_set_vms_run_command_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -20047,99 +20645,107 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_update( + async def begin_run_command( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: _models.CapacityReservationUpdate, + vm_scale_set_name: str, + instance_id: str, + parameters: _models.RunCommandInput, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CapacityReservation]: - """The operation to update a capacity reservation. + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationUpdate + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_run_command( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, + vm_scale_set_name: str, + instance_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CapacityReservation]: - """The operation to update a capacity reservation. + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_run_command( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservationUpdate, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.RunCommandInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.CapacityReservation]: - """The operation to update a capacity reservation. + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Run command on a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Is either - a CapacityReservationUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CapacityReservation or the result of + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Is either a + RunCommandInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput or IO[bytes] + :return: An instance of AsyncLROPoller that returns either RunCommandResult or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -20147,15 +20753,15 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._run_command_initial( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, parameters=parameters, api_version=api_version, content_type=content_type, @@ -20168,34 +20774,88 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.CapacityReservation].from_continuation_token( + return AsyncLROPoller[_models.RunCommandResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.CapacityReservation]( + return AsyncLROPoller[_models.RunCommandResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - **kwargs: Any + @distributed_trace_async + async def simulate_eviction( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> None: + """The operation to simulate the eviction of spot virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _start_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20211,10 +20871,10 @@ async def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_capacity_reservations_delete_request( + _request = build_virtual_machine_scale_set_vms_start_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -20230,7 +20890,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -20238,31 +20898,31 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - **kwargs: Any + async def begin_start( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to delete a capacity reservation. This operation is allowed only when all the - associated resources are disassociated from the capacity reservation. Please refer to - https://aka.ms/CapacityReservation for more details. + """Starts a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -20276,10 +20936,10 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._start_initial( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -20294,7 +20954,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -20308,31 +20970,50 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + +class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`virtual_machine_scale_set_vm_extensions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace_async - async def get( + async def list( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, + vm_scale_set_name: str, + instance_id: str, *, - expand: Optional[Union[str, _models.CapacityReservationInstanceViewTypes]] = None, + expand: Optional[str] = None, **kwargs: Any - ) -> _models.CapacityReservation: - """The operation that retrieves information about the capacity reservation. + ) -> _models.VirtualMachineScaleSetVMExtensionsListResult: + """The operation to get all extensions of an instance in Virtual Machine Scaleset. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves a - snapshot of the runtime properties of the capacity reservation that is managed by the platform - and can change outside of control plane operations. "instanceView" Default value is None. - :paramtype expand: str or - ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationInstanceViewTypes - :return: CapacityReservation or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservation + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetVMExtensionsListResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtensionsListResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20347,12 +21028,12 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMExtensionsListResult] = kwargs.pop("cls", None) - _request = build_capacity_reservations_get_request( + _request = build_virtual_machine_scale_set_vm_extensions_list_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, expand=expand, api_version=api_version, @@ -20372,35 +21053,97 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) + deserialized = self._deserialize( + "VirtualMachineScaleSetVMExtensionsListResult", pipeline_response.http_response + ) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_by_capacity_reservation_group( - self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CapacityReservation"]: - """Lists all of the capacity reservations in the specified capacity reservation group. Use the - nextLink property in the response to get the next page of capacity reservations. + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.VirtualMachineScaleSetVMExtension: + """The operation to get the VMSS VM extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :return: An iterator like instance of either CapacityReservation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetVMExtension or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.CapacityReservationListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vm_extensions_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20409,83 +21152,227 @@ def list_by_capacity_reservation_group( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_capacity_reservations_list_by_capacity_reservation_group_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters + else: + _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetVMExtension") - async def extract_data(pipeline_response): - deserialized = self._deserialize("CapacityReservationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + _request = build_virtual_machine_scale_set_vm_extensions_create_or_update_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + if 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return pipeline_response + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineScaleSetVMExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. - return AsyncItemPaged(get_next, extract_data) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. -class LogAnalyticsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Is either a VirtualMachineScaleSetVMExtension type or a IO[bytes] type. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension or IO[bytes] + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`log_analytics` attribute. - """ + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - models = _models + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _export_request_rate_by_interval_initial( - self, location: str, parameters: Union[_models.RequestRateByIntervalInput, IO[bytes]], **kwargs: Any + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20505,13 +21392,16 @@ async def _export_request_rate_by_interval_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _json = self._serialize.body(parameters, "RequestRateByIntervalInput") + _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetVMExtensionUpdate") - _request = build_log_analytics_export_request_rate_by_interval_request( - location=location, + _request = build_virtual_machine_scale_set_vm_extensions_update_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -20530,7 +21420,7 @@ async def _export_request_rate_by_interval_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -20538,79 +21428,120 @@ async def _export_request_rate_by_interval_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - async def begin_export_request_rate_by_interval( + async def begin_update( self, - location: str, - parameters: _models.RequestRateByIntervalInput, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineScaleSetVMExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RequestRateByIntervalInput + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the - result of cls(response) + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or + the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_export_request_rate_by_interval( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: IO[bytes] + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the - result of cls(response) + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or + the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_export_request_rate_by_interval( - self, location: str, parameters: Union[_models.RequestRateByIntervalInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is - either a RequestRateByIntervalInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RequestRateByIntervalInput or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the - result of cls(response) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Is either a VirtualMachineScaleSetVMExtensionUpdate type or a IO[bytes] type. + Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtensionUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either VirtualMachineScaleSetVMExtension or + the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -20618,14 +21549,17 @@ async def begin_export_request_rate_by_interval( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._export_request_rate_by_interval_initial( - location=location, - parameters=parameters, + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -20637,33 +21571,37 @@ async def begin_export_request_rate_by_interval( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LogAnalyticsOperationResult", pipeline_response.http_response) + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.LogAnalyticsOperationResult]( + return AsyncLROPoller[_models.VirtualMachineScaleSetVMExtension]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _export_throttled_requests_initial( - self, location: str, parameters: Union[_models.ThrottledRequestsInput, IO[bytes]], **kwargs: Any + async def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20673,28 +21611,19 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ThrottledRequestsInput") - - _request = build_log_analytics_export_throttled_requests_request( - location=location, + _request = build_virtual_machine_scale_set_vm_extensions_delete_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -20708,7 +21637,7 @@ async def _export_throttled_requests_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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): @@ -20716,93 +21645,52 @@ async def _export_throttled_requests_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - async def begin_export_throttled_requests( - self, - location: str, - parameters: _models.ThrottledRequestsInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getThrottledRequests Api. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ThrottledRequestsInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_export_throttled_requests( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getThrottledRequests Api. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_export_throttled_requests( - self, location: str, parameters: Union[_models.ThrottledRequestsInput, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. + async def begin_delete( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the VMSS VM extension. - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getThrottledRequests Api. Is either - a ThrottledRequestsInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ThrottledRequestsInput or IO[bytes] - :return: An instance of AsyncLROPoller that returns either LogAnalyticsOperationResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._export_throttled_requests_initial( - location=location, - parameters=parameters, + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -20811,70 +21699,80 @@ async def begin_export_throttled_requests( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LogAnalyticsOperationResult", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.LogAnalyticsOperationResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore -class VirtualMachineRunCommandsOperations: +class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machine_run_commands` attribute. + :attr:`virtual_machine_scale_set_vm_run_commands` attribute. """ models = _models def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.RunCommandDocumentBase"]: - """Lists all available run commands for a subscription in a location. + def list( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineRunCommand"]: + """The operation to get all run commands of an instance in Virtual Machine Scaleset. - :param location: The location upon which run commands is queried. Required. - :type location: str - :return: An iterator like instance of either RunCommandDocumentBase or the result of + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of either VirtualMachineRunCommand or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.RunCommandDocumentBase] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RunCommandListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommandsListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20887,9 +21785,12 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.RunComman def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_run_commands_list_request( - location=location, + _request = build_virtual_machine_scale_set_vm_run_commands_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -20914,7 +21815,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("RunCommandListResult", pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -20938,15 +21839,31 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get(self, location: str, command_id: str, **kwargs: Any) -> _models.RunCommandDocument: - """Gets specific run command for a subscription in a location. + async def get( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.VirtualMachineRunCommand: + """The operation to get the VMSS VM run command. - :param location: The location upon which run commands is queried. Required. - :type location: str - :param command_id: The command id. Required. - :type command_id: str - :return: RunCommandDocument or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RunCommandDocument + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineRunCommand or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20961,12 +21878,15 @@ async def get(self, location: str, command_id: str, **kwargs: Any) -> _models.Ru _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RunCommandDocument] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - _request = build_virtual_machine_run_commands_get_request( - location=location, - command_id=command_id, + _request = build_virtual_machine_scale_set_vm_run_commands_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -20984,7 +21904,7 @@ async def get(self, location: str, command_id: str, **kwargs: Any) -> _models.Ru map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RunCommandDocument", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20994,7 +21914,8 @@ async def get(self, location: str, command_id: str, **kwargs: Any) -> _models.Ru async def _create_or_update_initial( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], **kwargs: Any @@ -21022,9 +21943,10 @@ async def _create_or_update_initial( else: _json = self._serialize.body(run_command, "VirtualMachineRunCommand") - _request = build_virtual_machine_run_commands_create_or_update_request( + _request = build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, run_command_name=run_command_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -21052,10 +21974,15 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -21063,21 +21990,24 @@ async def _create_or_update_initial( async def begin_create_or_update( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: _models.VirtualMachineRunCommand, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the run command. + """The operation to create or update the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be created or - updated. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. @@ -21096,27 +22026,30 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the run command. + """The operation to create or update the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be created or - updated. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is "application/json". + Default value is "application/json". :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) @@ -21129,19 +22062,22 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the run command. + """The operation to create or update the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be created or - updated. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is either a VirtualMachineRunCommand type or a IO[bytes] type. Required. @@ -21164,7 +22100,8 @@ async def begin_create_or_update( if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, api_version=api_version, @@ -21184,7 +22121,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -21203,7 +22142,8 @@ def get_long_running_output(pipeline_response): async def _update_initial( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], **kwargs: Any @@ -21231,9 +22171,10 @@ async def _update_initial( else: _json = self._serialize.body(run_command, "VirtualMachineRunCommandUpdate") - _request = build_virtual_machine_run_commands_update_request( + _request = build_virtual_machine_scale_set_vm_run_commands_update_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, run_command_name=run_command_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -21261,10 +22202,14 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -21272,24 +22217,26 @@ async def _update_initial( async def begin_update( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: _models.VirtualMachineRunCommandUpdate, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the run command. + """The operation to update the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be updated. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. + :param run_command: Resource create parameters. Required. :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -21305,27 +22252,29 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the run command. + """The operation to update the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be updated. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. + :param run_command: Resource create parameters. Required. :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is "application/json". + Default value is "application/json". :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the result of cls(response) @@ -21338,22 +22287,25 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the run command. + """The operation to update the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be updated. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is - either a VirtualMachineRunCommandUpdate type or a IO[bytes] type. Required. + :param run_command: Resource create parameters. Is either a VirtualMachineRunCommandUpdate type + or a IO[bytes] type. Required. :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the @@ -21374,7 +22326,8 @@ async def begin_update( if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, api_version=api_version, @@ -21388,13 +22341,20 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -21411,7 +22371,7 @@ def get_long_running_output(pipeline_response): ) async def _delete_initial( - self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -21427,9 +22387,10 @@ async def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_run_commands_delete_request( + _request = build_virtual_machine_scale_set_vm_run_commands_delete_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, run_command_name=run_command_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -21454,25 +22415,32 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async async def begin_delete( - self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to delete the run command. + """The operation to delete the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be deleted. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] @@ -21489,7 +22457,8 @@ async def begin_delete( if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, run_command_name=run_command_name, api_version=api_version, cls=lambda x, y, z: x, @@ -21505,7 +22474,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -21519,28 +22490,42 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + +class VirtualMachineExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s + :attr:`virtual_machine_extensions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace_async - async def get_by_virtual_machine( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - *, - expand: Optional[str] = None, - **kwargs: Any - ) -> _models.VirtualMachineRunCommand: - """The operation to get the run command. + async def list( + self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.VirtualMachineExtensionsListResult: + """The operation to get all extensions of a Virtual Machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine containing the run command. Required. + :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str :keyword expand: The expand expression to apply on the operation. Default value is None. :paramtype expand: str - :return: VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand + :return: VirtualMachineExtensionsListResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionsListResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -21555,12 +22540,11 @@ async def get_by_virtual_machine( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtensionsListResult] = kwargs.pop("cls", None) - _request = build_virtual_machine_run_commands_get_by_virtual_machine_request( + _request = build_virtual_machine_extensions_list_request( resource_group_name=resource_group_name, vm_name=vm_name, - run_command_name=run_command_name, subscription_id=self._config.subscription_id, expand=expand, api_version=api_version, @@ -21580,37 +22564,38 @@ async def get_by_virtual_machine( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineExtensionsListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_by_virtual_machine( - self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.VirtualMachineRunCommand"]: - """The operation to get all run commands of a Virtual Machine. + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.VirtualMachineExtension: + """The operation to get the extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine containing the run command. Required. + :param vm_name: The name of the virtual machine. Required. :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str :keyword expand: The expand expression to apply on the operation. Default value is None. :paramtype expand: str - :return: An iterator like instance of either VirtualMachineRunCommand or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + :return: VirtualMachineExtension or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineRunCommandsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21619,89 +22604,48 @@ def list_by_virtual_machine( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machine_run_commands_list_by_virtual_machine_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) - return pipeline_response + _request = build_virtual_machine_extensions_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - return AsyncItemPaged(get_next, extract_data) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response -class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.aio.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_vm_run_commands` attribute. - """ + deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) - models = _models + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], + vm_name: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtension, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -21722,16 +22666,15 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _json = self._serialize.body(run_command, "VirtualMachineRunCommand") + _json = self._serialize.body(extension_parameters, "VirtualMachineExtension") - _request = build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( + _request = build_virtual_machine_extensions_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -21758,10 +22701,15 @@ async def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -21769,34 +22717,32 @@ async def _create_or_update_initial( async def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommand, + vm_name: str, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineExtension, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the VMSS VM run command. + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the + :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -21804,34 +22750,32 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: IO[bytes], + vm_name: str, + vm_extension_name: str, + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the VMSS VM run command. + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type run_command: IO[bytes] + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is "application/json". + Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the + :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -21839,29 +22783,28 @@ async def begin_create_or_update( async def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], + vm_name: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtension, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the VMSS VM run command. + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is - either a VirtualMachineRunCommand type or a IO[bytes] type. Required. - :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Is either a VirtualMachineExtension type or a IO[bytes] type. Required. + :type extension_parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -21869,17 +22812,16 @@ async def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - run_command=run_command, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -21891,35 +22833,36 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachineRunCommand].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachineRunCommand]( + return AsyncLROPoller[_models.VirtualMachineExtension]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) async def _update_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], + vm_name: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtensionUpdate, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -21940,16 +22883,15 @@ async def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _json = self._serialize.body(run_command, "VirtualMachineRunCommandUpdate") + _json = self._serialize.body(extension_parameters, "VirtualMachineExtensionUpdate") - _request = build_virtual_machine_scale_set_vm_run_commands_update_request( + _request = build_virtual_machine_extensions_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -21976,10 +22918,14 @@ async def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -21987,34 +22933,33 @@ async def _update_initial( async def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommandUpdate, + vm_name: str, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the VMSS VM run command. + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandUpdate + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the + :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -22022,65 +22967,61 @@ async def begin_update( async def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: IO[bytes], + vm_name: str, + vm_extension_name: str, + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the VMSS VM run command. + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type run_command: IO[bytes] + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is "application/json". + Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the + :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtensionUpdate, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the VMSS VM run command. + ) -> AsyncLROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is - either a VirtualMachineRunCommandUpdate type or a IO[bytes] type. Required. - :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandUpdate or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualMachineRunCommand or the + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Is either a VirtualMachineExtensionUpdate type or a IO[bytes] type. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either VirtualMachineExtension or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -22088,17 +23029,16 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - run_command=run_command, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -22110,30 +23050,37 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualMachineRunCommand].from_continuation_token( + return AsyncLROPoller[_models.VirtualMachineExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualMachineRunCommand]( + return AsyncLROPoller[_models.VirtualMachineExtension]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) async def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any + self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -22149,11 +23096,10 @@ async def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_run_commands_delete_request( + _request = build_virtual_machine_extensions_delete_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -22177,27 +23123,31 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async async def begin_delete( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any + self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """The operation to delete the VMSS VM run command. + """The operation to delete the extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -22213,9 +23163,8 @@ async def begin_delete( if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -22230,7 +23179,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -22243,171 +23194,3 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- deserialization_callback=get_long_running_output, ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - *, - expand: Optional[str] = None, - **kwargs: Any - ) -> _models.VirtualMachineRunCommand: - """The operation to get the VMSS VM run command. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vm_run_commands_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.VirtualMachineRunCommand"]: - """The operation to get all run commands of an instance in Virtual Machine Scaleset. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: An iterator like instance of either VirtualMachineRunCommand or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineRunCommandsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machine_scale_set_vm_run_commands_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/models/__init__.py index 3ca60bcc7b9a..d8179091e474 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/models/__init__.py @@ -44,8 +44,6 @@ CapacityReservationProfile, CapacityReservationUpdate, CapacityReservationUtilization, - ComputeOperationListResult, - ComputeOperationValue, ConvertToVirtualMachineScaleSetInput, DataDisk, DataDiskImage, @@ -112,6 +110,9 @@ OSImageNotificationProfile, OSProfile, OSProfileProvisioningData, + Operation, + OperationDisplay, + OperationListResult, OrchestrationServiceStateInput, OrchestrationServiceSummary, PatchInstallationDetail, @@ -133,8 +134,10 @@ ResilientVMCreationPolicy, ResilientVMDeletionPolicy, Resource, + ResourceAutoGenerated, ResourceSharingProfile, ResourceWithOptionalLocation, + ResourceWithOptionalLocationAutoGenerated, RestorePoint, RestorePointCollection, RestorePointCollectionListResult, @@ -184,8 +187,10 @@ SubResourceReadOnly, SubResourceWithColocationStatus, SystemData, + SystemDataAutoGenerated, TerminateNotificationProfile, ThrottledRequestsInput, + TrackedResource, UefiSettings, UpdateResource, UpgradeOperationHistoricalStatusInfo, @@ -195,6 +200,7 @@ Usage, UsageName, UserAssignedIdentitiesValue, + UserAssignedIdentitiesValueAutoGenerated, UserInitiatedReboot, UserInitiatedRedeploy, VMDiskSecurityProfile, @@ -303,6 +309,7 @@ ) from ._compute_management_client_enums import ( # type: ignore + ActionType, AllocationStrategy, AlternativeType, ArchitectureTypes, @@ -311,6 +318,7 @@ CapacityReservationGroupInstanceViewTypes, CapacityReservationInstanceViewTypes, ConsistencyModeTypes, + CreatedByType, DedicatedHostLicenseTypes, DeleteOptions, DiffDiskOptions, @@ -322,6 +330,7 @@ DomainNameLabelScopeTypes, ExecutionState, Expand, + ExpandAutoGenerated, ExpandTypeForListVMs, ExpandTypesForGetCapacityReservationGroups, ExpandTypesForGetVMScaleSets, @@ -351,6 +360,7 @@ OrchestrationServiceNames, OrchestrationServiceState, OrchestrationServiceStateAction, + Origin, PatchAssessmentState, PatchInstallationState, PatchOperationStatus, @@ -431,8 +441,6 @@ "CapacityReservationProfile", "CapacityReservationUpdate", "CapacityReservationUtilization", - "ComputeOperationListResult", - "ComputeOperationValue", "ConvertToVirtualMachineScaleSetInput", "DataDisk", "DataDiskImage", @@ -499,6 +507,9 @@ "OSImageNotificationProfile", "OSProfile", "OSProfileProvisioningData", + "Operation", + "OperationDisplay", + "OperationListResult", "OrchestrationServiceStateInput", "OrchestrationServiceSummary", "PatchInstallationDetail", @@ -520,8 +531,10 @@ "ResilientVMCreationPolicy", "ResilientVMDeletionPolicy", "Resource", + "ResourceAutoGenerated", "ResourceSharingProfile", "ResourceWithOptionalLocation", + "ResourceWithOptionalLocationAutoGenerated", "RestorePoint", "RestorePointCollection", "RestorePointCollectionListResult", @@ -571,8 +584,10 @@ "SubResourceReadOnly", "SubResourceWithColocationStatus", "SystemData", + "SystemDataAutoGenerated", "TerminateNotificationProfile", "ThrottledRequestsInput", + "TrackedResource", "UefiSettings", "UpdateResource", "UpgradeOperationHistoricalStatusInfo", @@ -582,6 +597,7 @@ "Usage", "UsageName", "UserAssignedIdentitiesValue", + "UserAssignedIdentitiesValueAutoGenerated", "UserInitiatedReboot", "UserInitiatedRedeploy", "VMDiskSecurityProfile", @@ -687,6 +703,7 @@ "WindowsConfiguration", "WindowsParameters", "WindowsVMGuestPatchAutomaticByPlatformSettings", + "ActionType", "AllocationStrategy", "AlternativeType", "ArchitectureTypes", @@ -695,6 +712,7 @@ "CapacityReservationGroupInstanceViewTypes", "CapacityReservationInstanceViewTypes", "ConsistencyModeTypes", + "CreatedByType", "DedicatedHostLicenseTypes", "DeleteOptions", "DiffDiskOptions", @@ -706,6 +724,7 @@ "DomainNameLabelScopeTypes", "ExecutionState", "Expand", + "ExpandAutoGenerated", "ExpandTypeForListVMs", "ExpandTypesForGetCapacityReservationGroups", "ExpandTypesForGetVMScaleSets", @@ -735,6 +754,7 @@ "OrchestrationServiceNames", "OrchestrationServiceState", "OrchestrationServiceStateAction", + "Origin", "PatchAssessmentState", "PatchInstallationState", "PatchOperationStatus", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/models/_compute_management_client_enums.py index 3720d04833a5..8c86112d8c4d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/models/_compute_management_client_enums.py @@ -11,6 +11,12 @@ from azure.core import CaseInsensitiveEnumMeta +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + + INTERNAL = "Internal" + + class AllocationStrategy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the allocation strategy for the virtual machine scale set based on which the VMs will be allocated. @@ -78,6 +84,15 @@ class ConsistencyModeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): APPLICATION_CONSISTENT = "ApplicationConsistent" +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + class DedicatedHostLicenseTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the software license type that will be applied to the VMs deployed on the dedicated host. Possible values are: **None,** **Windows_Server_Hybrid,** **Windows_Server_Perpetual.** @@ -168,8 +183,8 @@ class DiskDetachOptionTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): detachment attempt of the data disk did not complete due to an unexpected failure from the virtual machine and the disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed when - using this detach behavior. To force-detach a data disk update toBeDetached to 'true' along - with setting detachOption: 'ForceDetach'. + using this detach behavior. **This feature is still in preview**. To force-detach a data disk + update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. """ FORCE_DETACH = "ForceDetach" @@ -205,6 +220,12 @@ class Expand(str, Enum, metaclass=CaseInsensitiveEnumMeta): PROPERTIES = "Properties" +class ExpandAutoGenerated(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ExpandAutoGenerated.""" + + PROPERTIES = "Properties" + + class ExpandTypeForListVMs(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ExpandTypeForListVMs.""" @@ -293,8 +314,8 @@ class IPVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): class IPVersions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Available from Api-Version 2019-07-01 onwards, it represents whether the specific - ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and + """Available from Api-Version 2017-03-30 onwards, it represents whether the specific + ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. """ @@ -346,8 +367,10 @@ class MaintenanceOperationResultCodeTypes(str, Enum, metaclass=CaseInsensitiveEn class Mode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies the mode that ProxyAgent will execute on. Warning: this property has been deprecated, - please specify 'mode' under particular hostendpoint setting. + """Specifies the mode that ProxyAgent will execute on if the feature is enabled. ProxyAgent will + start to audit or monitor but not enforce access control over requests to host endpoints in + Audit mode, while in Enforce mode it will enforce access control. The default value is Enforce + mode. """ AUDIT = "Audit" @@ -429,7 +452,6 @@ class OrchestrationServiceNames(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of the service.""" AUTOMATIC_REPAIRS = "AutomaticRepairs" - DUMMY_ORCHESTRATION_SERVICE_NAME = "DummyOrchestrationServiceName" class OrchestrationServiceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -447,6 +469,16 @@ class OrchestrationServiceStateAction(str, Enum, metaclass=CaseInsensitiveEnumMe SUSPEND = "Suspend" +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + + class PatchAssessmentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the availability of a given patch.""" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/models/_models_py3.py index 912c010949ad..c5c27fcf9377 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,19 +8,12 @@ # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object class AdditionalCapabilities(_serialization.Model): @@ -334,7 +327,7 @@ class AutomaticOSUpgradePolicy(_serialization.Model): applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. If this is set to true for Windows based scale sets, `enableAutomaticUpdates - `_ # pylint: disable=line-too-long + `_ is automatically set to false and cannot be set to true. :vartype enable_automatic_os_upgrade: bool :ivar disable_automatic_rollback: Whether OS image rollback feature should be disabled. Default @@ -372,7 +365,7 @@ def __init__( applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available. Default value is false. If this is set to true for Windows based scale sets, `enableAutomaticUpdates - `_ # pylint: disable=line-too-long + `_ is automatically set to false and cannot be set to true. :paramtype enable_automatic_os_upgrade: bool :keyword disable_automatic_rollback: Whether OS image rollback feature should be disabled. @@ -526,28 +519,76 @@ def __init__( class Resource(_serialization.Model): - """The Resource model definition. + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, } @@ -555,26 +596,24 @@ class Resource(_serialization.Model): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location self.tags = tags + self.location = location -class AvailabilitySet(Resource): +class AvailabilitySet(TrackedResource): """Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Availability sets @@ -589,16 +628,21 @@ class AvailabilitySet(Resource): All required parameters must be populated in order to send to server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar sku: Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is @@ -629,6 +673,7 @@ class AvailabilitySet(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "statuses": {"readonly": True}, "virtual_machine_scale_set_migration_info": {"readonly": True}, @@ -638,8 +683,9 @@ class AvailabilitySet(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "sku": {"key": "sku", "type": "Sku"}, "platform_update_domain_count": {"key": "properties.platformUpdateDomainCount", "type": "int"}, "platform_fault_domain_count": {"key": "properties.platformFaultDomainCount", "type": "int"}, @@ -667,10 +713,10 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword sku: Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is @@ -692,15 +738,15 @@ def __init__( :paramtype scheduled_events_policy: ~azure.mgmt.compute.v2024_11_01.models.ScheduledEventsPolicy """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.platform_update_domain_count = platform_update_domain_count self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines self.proximity_placement_group = proximity_placement_group - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None self.scheduled_events_policy = scheduled_events_policy - self.virtual_machine_scale_set_migration_info = None + self.virtual_machine_scale_set_migration_info: Optional["_models.VirtualMachineScaleSetMigrationInfo"] = None class AvailabilitySetListResult(_serialization.Model): @@ -849,9 +895,9 @@ def __init__( self.platform_fault_domain_count = platform_fault_domain_count self.virtual_machines = virtual_machines self.proximity_placement_group = proximity_placement_group - self.statuses = None + self.statuses: Optional[List["_models.InstanceViewStatus"]] = None self.scheduled_events_policy = scheduled_events_policy - self.virtual_machine_scale_set_migration_info = None + self.virtual_machine_scale_set_migration_info: Optional["_models.VirtualMachineScaleSetMigrationInfo"] = None class AvailablePatchSummary(_serialization.Model): @@ -910,14 +956,14 @@ class AvailablePatchSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None - self.assessment_activity_id = None - self.reboot_pending = None - self.critical_and_security_patch_count = None - self.other_patch_count = None - self.start_time = None - self.last_modified_time = None - self.error = None + self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None + self.assessment_activity_id: Optional[str] = None + self.reboot_pending: Optional[bool] = None + self.critical_and_security_patch_count: Optional[int] = None + self.other_patch_count: Optional[int] = None + self.start_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.error: Optional["_models.ApiError"] = None class BillingProfile(_serialization.Model): @@ -1026,39 +1072,40 @@ class BootDiagnosticsInstanceView(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None - self.status = None + self.console_screenshot_blob_uri: Optional[str] = None + self.serial_console_log_blob_uri: Optional[str] = None + self.status: Optional["_models.InstanceViewStatus"] = None -class CapacityReservation(Resource): +class CapacityReservation(TrackedResource): """Specifies information about the capacity reservation. 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar sku: SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. Required. :vartype sku: ~azure.mgmt.compute.v2024_11_01.models.Sku - :ivar zones: Availability Zone to use for this capacity reservation. The zone has to be single - value and also should be part for the list of zones specified during the capacity reservation - group creation. The zone can be assigned only during creation. If not provided, the reservation - supports only non-zonal deployments. If provided, enforces VM/VMSS using this capacity - reservation to be in same zone. + :ivar zones: The availability zones. :vartype zones: list[str] :ivar reservation_id: A unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource. @@ -1087,6 +1134,7 @@ class CapacityReservation(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "sku": {"required": True}, "reservation_id": {"readonly": True}, @@ -1102,8 +1150,9 @@ class CapacityReservation(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "sku": {"key": "sku", "type": "Sku"}, "zones": {"key": "zones", "type": "[str]"}, "reservation_id": {"key": "properties.reservationId", "type": "str"}, @@ -1125,36 +1174,32 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword sku: SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. Required. :paramtype sku: ~azure.mgmt.compute.v2024_11_01.models.Sku - :keyword zones: Availability Zone to use for this capacity reservation. The zone has to be - single value and also should be part for the list of zones specified during the capacity - reservation group creation. The zone can be assigned only during creation. If not provided, the - reservation supports only non-zonal deployments. If provided, enforces VM/VMSS using this - capacity reservation to be in same zone. + :keyword zones: The availability zones. :paramtype zones: list[str] """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.zones = zones - self.reservation_id = None - self.platform_fault_domain_count = None - self.virtual_machines_associated = None - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None - self.time_created = None + self.reservation_id: Optional[str] = None + self.platform_fault_domain_count: Optional[int] = None + self.virtual_machines_associated: Optional[List["_models.SubResourceReadOnly"]] = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.CapacityReservationInstanceView"] = None + self.time_created: Optional[datetime.datetime] = None -class CapacityReservationGroup(Resource): +class CapacityReservationGroup(TrackedResource): """Specifies information about the capacity reservation group that the capacity reservations should be assigned to. Currently, a capacity reservation can only be added to a capacity reservation group at creation time. An existing capacity reservation cannot be added or moved @@ -1164,20 +1209,22 @@ class CapacityReservationGroup(Resource): All required parameters must be populated in order to send to server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar zones: Availability Zones to use for this capacity reservation group. The zones can be - assigned only during creation. If not provided, the group supports only regional resources in - the region. If provided, enforces each capacity reservation in the group to be in one of the - zones. + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar zones: The availability zones. :vartype zones: list[str] :ivar capacity_reservations: A list of all capacity reservation resource ids that belong to capacity reservation group. @@ -1204,6 +1251,7 @@ class CapacityReservationGroup(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "capacity_reservations": {"readonly": True}, "virtual_machines_associated": {"readonly": True}, @@ -1214,8 +1262,9 @@ class CapacityReservationGroup(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "zones": {"key": "zones", "type": "[str]"}, "capacity_reservations": {"key": "properties.capacityReservations", "type": "[SubResourceReadOnly]"}, "virtual_machines_associated": {"key": "properties.virtualMachinesAssociated", "type": "[SubResourceReadOnly]"}, @@ -1233,14 +1282,11 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword zones: Availability Zones to use for this capacity reservation group. The zones can be - assigned only during creation. If not provided, the group supports only regional resources in - the region. If provided, enforces each capacity reservation in the group to be in one of the - zones. + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword zones: The availability zones. :paramtype zones: list[str] :keyword sharing_profile: Specifies the settings to enable sharing across subscriptions for the capacity reservation group resource. Pls. keep in mind the capacity reservation group resource @@ -1250,11 +1296,11 @@ def __init__( more details. :paramtype sharing_profile: ~azure.mgmt.compute.v2024_11_01.models.ResourceSharingProfile """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.zones = zones - self.capacity_reservations = None - self.virtual_machines_associated = None - self.instance_view = None + self.capacity_reservations: Optional[List["_models.SubResourceReadOnly"]] = None + self.virtual_machines_associated: Optional[List["_models.SubResourceReadOnly"]] = None + self.instance_view: Optional["_models.CapacityReservationGroupInstanceView"] = None self.sharing_profile = sharing_profile @@ -1287,8 +1333,8 @@ class CapacityReservationGroupInstanceView(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.capacity_reservations = None - self.shared_subscription_ids = None + self.capacity_reservations: Optional[List["_models.CapacityReservationInstanceViewWithName"]] = None + self.shared_subscription_ids: Optional[List["_models.SubResourceReadOnly"]] = None class CapacityReservationGroupListResult(_serialization.Model): @@ -1388,9 +1434,9 @@ def __init__( :paramtype sharing_profile: ~azure.mgmt.compute.v2024_11_01.models.ResourceSharingProfile """ super().__init__(tags=tags, **kwargs) - self.capacity_reservations = None - self.virtual_machines_associated = None - self.instance_view = None + self.capacity_reservations: Optional[List["_models.SubResourceReadOnly"]] = None + self.virtual_machines_associated: Optional[List["_models.SubResourceReadOnly"]] = None + self.instance_view: Optional["_models.CapacityReservationGroupInstanceView"] = None self.sharing_profile = sharing_profile @@ -1470,7 +1516,7 @@ def __init__( :paramtype statuses: list[~azure.mgmt.compute.v2024_11_01.models.InstanceViewStatus] """ super().__init__(utilization_info=utilization_info, statuses=statuses, **kwargs) - self.name = None + self.name: Optional[str] = None class CapacityReservationListResult(_serialization.Model): @@ -1609,13 +1655,13 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.sku = sku - self.reservation_id = None - self.platform_fault_domain_count = None - self.virtual_machines_associated = None - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None - self.time_created = None + self.reservation_id: Optional[str] = None + self.platform_fault_domain_count: Optional[int] = None + self.virtual_machines_associated: Optional[List["_models.SubResourceReadOnly"]] = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.CapacityReservationInstanceView"] = None + self.time_created: Optional[datetime.datetime] = None class CapacityReservationUtilization(_serialization.Model): @@ -1646,79 +1692,8 @@ class CapacityReservationUtilization(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.current_capacity = None - self.virtual_machines_allocated = None - - -class ComputeOperationListResult(_serialization.Model): - """The List Compute Operation operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of compute operations. - :vartype value: list[~azure.mgmt.compute.v2024_11_01.models.ComputeOperationValue] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ComputeOperationValue]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class ComputeOperationValue(_serialization.Model): - """Describes the properties of a Compute Operation value. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar origin: The origin of the compute operation. - :vartype origin: str - :ivar name: The name of the compute operation. - :vartype name: str - :ivar operation: The display name of the compute operation. - :vartype operation: str - :ivar resource: The display name of the resource the operation applies to. - :vartype resource: str - :ivar description: The description of the operation. - :vartype description: str - :ivar provider: The resource provider for the operation. - :vartype provider: str - """ - - _validation = { - "origin": {"readonly": True}, - "name": {"readonly": True}, - "operation": {"readonly": True}, - "resource": {"readonly": True}, - "description": {"readonly": True}, - "provider": {"readonly": True}, - } - - _attribute_map = { - "origin": {"key": "origin", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "operation": {"key": "display.operation", "type": "str"}, - "resource": {"key": "display.resource", "type": "str"}, - "description": {"key": "display.description", "type": "str"}, - "provider": {"key": "display.provider", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.origin = None - self.name = None - self.operation = None - self.resource = None - self.description = None - self.provider = None + self.current_capacity: Optional[int] = None + self.virtual_machines_allocated: Optional[List["_models.SubResourceReadOnly"]] = None class ConvertToVirtualMachineScaleSetInput(_serialization.Model): @@ -1805,8 +1780,8 @@ class DataDisk(_serialization.Model): previous detachment attempt of the data disk did not complete due to an unexpected failure from the virtual machine and the disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed when - using this detach behavior. To force-detach a data disk update toBeDetached to 'true' along - with setting detachOption: 'ForceDetach'. "ForceDetach" + using this detach behavior. **This feature is still in preview**. To force-detach a data disk + update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. "ForceDetach" :vartype detach_option: str or ~azure.mgmt.compute.v2024_11_01.models.DiskDetachOptionTypes :ivar delete_option: Specifies whether data disk should be deleted or detached upon VM deletion. Possible values are: **Delete.** If this value is used, the data disk is deleted when @@ -1906,8 +1881,8 @@ def __init__( previous detachment attempt of the data disk did not complete due to an unexpected failure from the virtual machine and the disk is still not released then use force-detach as a last resort option to detach the disk forcibly from the VM. All writes might not have been flushed when - using this detach behavior. To force-detach a data disk update toBeDetached to 'true' along - with setting detachOption: 'ForceDetach'. "ForceDetach" + using this detach behavior. **This feature is still in preview**. To force-detach a data disk + update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. "ForceDetach" :paramtype detach_option: str or ~azure.mgmt.compute.v2024_11_01.models.DiskDetachOptionTypes :keyword delete_option: Specifies whether data disk should be deleted or detached upon VM deletion. Possible values are: **Delete.** If this value is used, the data disk is deleted when @@ -1927,8 +1902,8 @@ def __init__( self.managed_disk = managed_disk self.source_resource = source_resource self.to_be_detached = to_be_detached - self.disk_iops_read_write = None - self.disk_m_bps_read_write = None + self.disk_iops_read_write: Optional[int] = None + self.disk_m_bps_read_write: Optional[int] = None self.detach_option = detach_option self.delete_option = delete_option @@ -1954,7 +1929,7 @@ class DataDiskImage(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.lun = None + self.lun: Optional[int] = None class DataDisksToAttach(_serialization.Model): @@ -2083,23 +2058,28 @@ def __init__( self.detach_option = detach_option -class DedicatedHost(Resource): +class DedicatedHost(TrackedResource): """Specifies information about the Dedicated host. 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar sku: SKU of the dedicated host for Hardware Generation and VM family. Only name is required to be set. List Microsoft.Compute SKUs for a list of possible values. Required. :vartype sku: ~azure.mgmt.compute.v2024_11_01.models.Sku @@ -2133,9 +2113,9 @@ class DedicatedHost(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "sku": {"required": True}, - "platform_fault_domain": {"minimum": 0}, "host_id": {"readonly": True}, "virtual_machines": {"readonly": True}, "provisioning_time": {"readonly": True}, @@ -2148,8 +2128,9 @@ class DedicatedHost(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "sku": {"key": "sku", "type": "Sku"}, "platform_fault_domain": {"key": "properties.platformFaultDomain", "type": "int"}, "auto_replace_on_failure": {"key": "properties.autoReplaceOnFailure", "type": "bool"}, @@ -2174,10 +2155,10 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword sku: SKU of the dedicated host for Hardware Generation and VM family. Only name is required to be set. List Microsoft.Compute SKUs for a list of possible values. Required. :paramtype sku: ~azure.mgmt.compute.v2024_11_01.models.Sku @@ -2194,17 +2175,17 @@ def __init__( :paramtype license_type: str or ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostLicenseTypes """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure - self.host_id = None - self.virtual_machines = None + self.host_id: Optional[str] = None + self.virtual_machines: Optional[List["_models.SubResourceReadOnly"]] = None self.license_type = license_type - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None - self.time_created = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.DedicatedHostInstanceView"] = None + self.time_created: Optional[datetime.datetime] = None class DedicatedHostAllocatableVM(_serialization.Model): @@ -2261,7 +2242,7 @@ def __init__( self.allocatable_v_ms = allocatable_v_ms -class DedicatedHostGroup(Resource): +class DedicatedHostGroup(TrackedResource): """Specifies information about the dedicated host group that the dedicated hosts should be assigned to. Currently, a dedicated host can only be added to a dedicated host group at creation time. An existing dedicated host cannot be added to another dedicated host group. @@ -2270,19 +2251,22 @@ class DedicatedHostGroup(Resource): All required parameters must be populated in order to send to server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar zones: Availability Zone to use for this host group. Only single zone is supported. The - zone can be assigned only during creation. If not provided, the group supports all zones in the - region. If provided, enforces each host in the group to be in the same zone. + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar zones: The availability zones. :vartype zones: list[str] :ivar platform_fault_domain_count: Number of fault domains that the host group can span. :vartype platform_fault_domain_count: int @@ -2306,6 +2290,7 @@ class DedicatedHostGroup(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "platform_fault_domain_count": {"minimum": 1}, "hosts": {"readonly": True}, @@ -2316,8 +2301,9 @@ class DedicatedHostGroup(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "zones": {"key": "zones", "type": "[str]"}, "platform_fault_domain_count": {"key": "properties.platformFaultDomainCount", "type": "int"}, "hosts": {"key": "properties.hosts", "type": "[SubResourceReadOnly]"}, @@ -2341,13 +2327,11 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword zones: Availability Zone to use for this host group. Only single zone is supported. - The zone can be assigned only during creation. If not provided, the group supports all zones in - the region. If provided, enforces each host in the group to be in the same zone. + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword zones: The availability zones. :paramtype zones: list[str] :keyword platform_fault_domain_count: Number of fault domains that the host group can span. :paramtype platform_fault_domain_count: int @@ -2361,11 +2345,11 @@ def __init__( :paramtype additional_capabilities: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroupPropertiesAdditionalCapabilities """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count - self.hosts = None - self.instance_view = None + self.hosts: Optional[List["_models.SubResourceReadOnly"]] = None + self.instance_view: Optional["_models.DedicatedHostGroupInstanceView"] = None self.support_automatic_placement = support_automatic_placement self.additional_capabilities = additional_capabilities @@ -2542,8 +2526,8 @@ def __init__( super().__init__(tags=tags, **kwargs) self.zones = zones self.platform_fault_domain_count = platform_fault_domain_count - self.hosts = None - self.instance_view = None + self.hosts: Optional[List["_models.SubResourceReadOnly"]] = None + self.instance_view: Optional["_models.DedicatedHostGroupInstanceView"] = None self.support_automatic_placement = support_automatic_placement self.additional_capabilities = additional_capabilities @@ -2588,7 +2572,7 @@ def __init__( :paramtype statuses: list[~azure.mgmt.compute.v2024_11_01.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.asset_id = None + self.asset_id: Optional[str] = None self.available_capacity = available_capacity self.statuses = statuses @@ -2638,7 +2622,7 @@ def __init__( :paramtype statuses: list[~azure.mgmt.compute.v2024_11_01.models.InstanceViewStatus] """ super().__init__(available_capacity=available_capacity, statuses=statuses, **kwargs) - self.name = None + self.name: Optional[str] = None class DedicatedHostListResult(_serialization.Model): @@ -2680,19 +2664,25 @@ class DedicatedHostSizeListResult(_serialization.Model): :ivar value: The list of dedicated host sizes. :vartype value: list[str] + :ivar next_link: The link to the next page of items. + :vartype next_link: str """ _attribute_map = { "value": {"key": "value", "type": "[str]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: + def __init__(self, *, value: Optional[List[str]] = None, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: The list of dedicated host sizes. :paramtype value: list[str] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value + self.next_link = next_link class DedicatedHostUpdate(UpdateResource): @@ -2734,7 +2724,6 @@ class DedicatedHostUpdate(UpdateResource): """ _validation = { - "platform_fault_domain": {"minimum": 0}, "host_id": {"readonly": True}, "virtual_machines": {"readonly": True}, "provisioning_time": {"readonly": True}, @@ -2791,13 +2780,13 @@ def __init__( self.sku = sku self.platform_fault_domain = platform_fault_domain self.auto_replace_on_failure = auto_replace_on_failure - self.host_id = None - self.virtual_machines = None + self.host_id: Optional[str] = None + self.virtual_machines: Optional[List["_models.SubResourceReadOnly"]] = None self.license_type = license_type - self.provisioning_time = None - self.provisioning_state = None - self.instance_view = None - self.time_created = None + self.provisioning_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.DedicatedHostInstanceView"] = None + self.time_created: Optional[datetime.datetime] = None class DefaultVirtualMachineScaleSetInfo(_serialization.Model): @@ -2829,8 +2818,8 @@ class DefaultVirtualMachineScaleSetInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.constrained_maximum_capacity = None - self.default_virtual_machine_scale_set = None + self.constrained_maximum_capacity: Optional[bool] = None + self.default_virtual_machine_scale_set: Optional["_models.SubResource"] = None class DiagnosticsProfile(_serialization.Model): @@ -3064,7 +3053,7 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class DiskRestorePointAttributes(SubResourceReadOnly): @@ -3391,7 +3380,7 @@ class HostEndpointSettings(_serialization.Model): :vartype mode: str or ~azure.mgmt.compute.v2024_11_01.models.Modes :ivar in_vm_access_control_profile_reference_id: Specifies the InVMAccessControlProfileVersion resource id in the format of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{profile}/versions/{version}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{profile}/versions/{version}. :vartype in_vm_access_control_profile_reference_id: str """ @@ -3416,7 +3405,7 @@ def __init__( :paramtype mode: str or ~azure.mgmt.compute.v2024_11_01.models.Modes :keyword in_vm_access_control_profile_reference_id: Specifies the InVMAccessControlProfileVersion resource id in the format of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{profile}/versions/{version}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{profile}/versions/{version}. :paramtype in_vm_access_control_profile_reference_id: str """ super().__init__(**kwargs) @@ -3424,7 +3413,7 @@ def __init__( self.in_vm_access_control_profile_reference_id = in_vm_access_control_profile_reference_id -class Image(Resource): +class Image(TrackedResource): """The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. @@ -3433,16 +3422,21 @@ class Image(Resource): All required parameters must be populated in order to send to server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar extended_location: The extended location of the Image. :vartype extended_location: ~azure.mgmt.compute.v2024_11_01.models.ExtendedLocation :ivar source_virtual_machine: The source virtual machine from which Image is created. @@ -3464,6 +3458,7 @@ class Image(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "provisioning_state": {"readonly": True}, } @@ -3472,8 +3467,9 @@ class Image(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "source_virtual_machine": {"key": "properties.sourceVirtualMachine", "type": "SubResource"}, "storage_profile": {"key": "properties.storageProfile", "type": "ImageStorageProfile"}, @@ -3493,10 +3489,10 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword extended_location: The extended location of the Image. :paramtype extended_location: ~azure.mgmt.compute.v2024_11_01.models.ExtendedLocation :keyword source_virtual_machine: The source virtual machine from which Image is created. @@ -3511,11 +3507,11 @@ def __init__( :paramtype hyper_v_generation: str or ~azure.mgmt.compute.v2024_11_01.models.HyperVGenerationTypes """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.extended_location = extended_location self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.hyper_v_generation = hyper_v_generation @@ -3932,7 +3928,7 @@ class ImageReference(SubResource): time even if a new version becomes available. Please do not use field 'version' for gallery image deployment, gallery image should always use 'id' field for deployment, to use 'latest' version of gallery image, just set - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' in the 'id' field without version input. :vartype version: str :ivar exact_version: Specifies in decimal numbers, the version of platform image or marketplace @@ -3991,7 +3987,7 @@ def __init__( after deploy time even if a new version becomes available. Please do not use field 'version' for gallery image deployment, gallery image should always use 'id' field for deployment, to use 'latest' version of gallery image, just set - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' in the 'id' field without version input. :paramtype version: str :keyword shared_gallery_image_id: Specified the shared gallery image unique id for vm @@ -4006,7 +4002,7 @@ def __init__( self.offer = offer self.sku = sku self.version = version - self.exact_version = None + self.exact_version: Optional[str] = None self.shared_gallery_image_id = shared_gallery_image_id self.community_gallery_image_id = community_gallery_image_id @@ -4125,7 +4121,7 @@ def __init__( super().__init__(tags=tags, **kwargs) self.source_virtual_machine = source_virtual_machine self.storage_profile = storage_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.hyper_v_generation = hyper_v_generation @@ -4345,17 +4341,17 @@ class LastPatchInstallationSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None - self.installation_activity_id = None - self.maintenance_window_exceeded = None - self.not_selected_patch_count = None - self.excluded_patch_count = None - self.pending_patch_count = None - self.installed_patch_count = None - self.failed_patch_count = None - self.start_time = None - self.last_modified_time = None - self.error = None + self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None + self.installation_activity_id: Optional[str] = None + self.maintenance_window_exceeded: Optional[bool] = None + self.not_selected_patch_count: Optional[int] = None + self.excluded_patch_count: Optional[int] = None + self.pending_patch_count: Optional[int] = None + self.installed_patch_count: Optional[int] = None + self.failed_patch_count: Optional[int] = None + self.start_time: Optional[datetime.datetime] = None + self.last_modified_time: Optional[datetime.datetime] = None + self.error: Optional["_models.ApiError"] = None class LinuxConfiguration(_serialization.Model): @@ -4731,7 +4727,7 @@ class LogAnalyticsOperationResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.properties = None + self.properties: Optional["_models.LogAnalyticsOutput"] = None class LogAnalyticsOutput(_serialization.Model): @@ -4754,7 +4750,7 @@ class LogAnalyticsOutput(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.output = None + self.output: Optional[str] = None class MaintenanceRedeployStatus(_serialization.Model): @@ -5057,13 +5053,133 @@ def __init__( self.network_interface_configurations = network_interface_configurations +class Operation(_serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.compute.v2024_11_01.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.compute.v2024_11_01.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.compute.v2024_11_01.models.ActionType + """ + + _validation = { + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "action_type": {"key": "actionType", "type": "str"}, + } + + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.compute.v2024_11_01.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name: Optional[str] = None + self.is_data_action: Optional[bool] = None + self.display = display + self.origin: Optional[Union[str, "_models.Origin"]] = None + self.action_type: Optional[Union[str, "_models.ActionType"]] = None + + +class OperationDisplay(_serialization.Model): + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + _validation = { + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provider: Optional[str] = None + self.resource: Optional[str] = None + self.operation: Optional[str] = None + self.description: Optional[str] = None + + +class OperationListResult(_serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.compute.v2024_11_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value: Optional[List["_models.Operation"]] = None + self.next_link: Optional[str] = None + + class OrchestrationServiceStateInput(_serialization.Model): """The input for OrchestrationServiceState. All required parameters must be populated in order to send to server. - :ivar service_name: The name of the service. Required. Known values are: "AutomaticRepairs" and - "DummyOrchestrationServiceName". + :ivar service_name: The name of the service. Required. "AutomaticRepairs" :vartype service_name: str or ~azure.mgmt.compute.v2024_11_01.models.OrchestrationServiceNames :ivar action: The action to be performed. Required. Known values are: "Resume" and "Suspend". :vartype action: str or ~azure.mgmt.compute.v2024_11_01.models.OrchestrationServiceStateAction @@ -5087,8 +5203,7 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword service_name: The name of the service. Required. Known values are: "AutomaticRepairs" - and "DummyOrchestrationServiceName". + :keyword service_name: The name of the service. Required. "AutomaticRepairs" :paramtype service_name: str or ~azure.mgmt.compute.v2024_11_01.models.OrchestrationServiceNames :keyword action: The action to be performed. Required. Known values are: "Resume" and @@ -5106,8 +5221,7 @@ class OrchestrationServiceSummary(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar service_name: The name of the service. Known values are: "AutomaticRepairs" and - "DummyOrchestrationServiceName". + :ivar service_name: The name of the service. "AutomaticRepairs" :vartype service_name: str or ~azure.mgmt.compute.v2024_11_01.models.OrchestrationServiceNames :ivar service_state: The current state of the service. Known values are: "NotRunning", "Running", and "Suspended". @@ -5127,8 +5241,8 @@ class OrchestrationServiceSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.service_name = None - self.service_state = None + self.service_name: Optional[Union[str, "_models.OrchestrationServiceNames"]] = None + self.service_state: Optional[Union[str, "_models.OrchestrationServiceState"]] = None class OSDisk(_serialization.Model): @@ -5626,12 +5740,12 @@ class PatchInstallationDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.patch_id = None - self.name = None - self.version = None - self.kb_id = None - self.classifications = None - self.installation_state = None + self.patch_id: Optional[str] = None + self.name: Optional[str] = None + self.version: Optional[str] = None + self.kb_id: Optional[str] = None + self.classifications: Optional[List[str]] = None + self.installation_state: Optional[Union[str, "_models.PatchInstallationState"]] = None class PatchSettings(_serialization.Model): @@ -5847,8 +5961,7 @@ class PriorityMixPolicy(_serialization.Model): """ _validation = { - "base_regular_priority_count": {"minimum": 0}, - "regular_priority_percentage_above_base": {"maximum": 100, "minimum": 0}, + "regular_priority_percentage_above_base": {"maximum": 100}, } _attribute_map = { @@ -5876,25 +5989,29 @@ def __init__( self.regular_priority_percentage_above_base = regular_priority_percentage_above_base -class ProximityPlacementGroup(Resource): +class ProximityPlacementGroup(TrackedResource): """Specifies information about the proximity placement group. 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar zones: Specifies the Availability Zone where virtual machine, virtual machine scale set - or availability set associated with the proximity placement group can be created. + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar zones: The availability zones. :vartype zones: list[str] :ivar proximity_placement_group_type: Specifies the type of the proximity placement group. Possible values are: **Standard** : Co-locate resources within an Azure region or Availability @@ -5923,6 +6040,7 @@ class ProximityPlacementGroup(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "virtual_machines": {"readonly": True}, "virtual_machine_scale_sets": {"readonly": True}, @@ -5933,8 +6051,9 @@ class ProximityPlacementGroup(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "zones": {"key": "zones", "type": "[str]"}, "proximity_placement_group_type": {"key": "properties.proximityPlacementGroupType", "type": "str"}, "virtual_machines": {"key": "properties.virtualMachines", "type": "[SubResourceWithColocationStatus]"}, @@ -5959,12 +6078,11 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword zones: Specifies the Availability Zone where virtual machine, virtual machine scale - set or availability set associated with the proximity placement group can be created. + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword zones: The availability zones. :paramtype zones: list[str] :keyword proximity_placement_group_type: Specifies the type of the proximity placement group. Possible values are: **Standard** : Co-locate resources within an Azure region or Availability @@ -5977,12 +6095,12 @@ def __init__( :paramtype intent: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroupPropertiesIntent """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.zones = zones self.proximity_placement_group_type = proximity_placement_group_type - self.virtual_machines = None - self.virtual_machine_scale_sets = None - self.availability_sets = None + self.virtual_machines: Optional[List["_models.SubResourceWithColocationStatus"]] = None + self.virtual_machine_scale_sets: Optional[List["_models.SubResourceWithColocationStatus"]] = None + self.availability_sets: Optional[List["_models.SubResourceWithColocationStatus"]] = None self.colocation_status = colocation_status self.intent = intent @@ -6117,39 +6235,25 @@ def __init__( self.imds = imds -class ProxyResource(_serialization.Model): - """The resource model definition for an Azure Resource Manager proxy resource. It will not have +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - class PublicIPAddressSku(_serialization.Model): """Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. @@ -6251,8 +6355,8 @@ class RecoveryWalkResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.walk_performed = None - self.next_platform_update_domain = None + self.walk_performed: Optional[bool] = None + self.next_platform_update_domain: Optional[int] = None class RequestRateByIntervalInput(LogAnalyticsInputBase): @@ -6447,7 +6551,56 @@ def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: :paramtype enabled: bool """ super().__init__(**kwargs) - self.enabled = enabled + self.enabled = enabled + + +class ResourceAutoGenerated(_serialization.Model): + """The Resource model definition. + + 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 server. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location = location + self.tags = tags class ResourceSharingProfile(_serialization.Model): @@ -6514,23 +6667,74 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s """ super().__init__(**kwargs) self.location = location - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags -class RestorePoint(ProxyResource): - """Restore Point details. +class ResourceWithOptionalLocationAutoGenerated(_serialization.Model): # pylint: disable=name-too-long + """The Resource model definition with location property as optional. Variables are only populated by the server, and will be ignored when sending a request. + :ivar location: Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.location = location + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.tags = tags + + +class RestorePoint(ProxyResource): + """Restore Point details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar exclude_disks: List of disk resource ids that the customer wishes to exclude from the restore point. If no disks are specified, all disks will be included. :vartype exclude_disks: list[~azure.mgmt.compute.v2024_11_01.models.ApiEntityReference] @@ -6557,6 +6761,7 @@ class RestorePoint(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, "instance_view": {"readonly": True}, } @@ -6565,6 +6770,7 @@ class RestorePoint(ProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "exclude_disks": {"key": "properties.excludeDisks", "type": "[ApiEntityReference]"}, "source_metadata": {"key": "properties.sourceMetadata", "type": "RestorePointSourceMetadata"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, @@ -6605,30 +6811,35 @@ def __init__( super().__init__(**kwargs) self.exclude_disks = exclude_disks self.source_metadata = source_metadata - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.consistency_mode = consistency_mode self.time_created = time_created self.source_restore_point = source_restore_point - self.instance_view = None + self.instance_view: Optional["_models.RestorePointInstanceView"] = None -class RestorePointCollection(Resource): +class RestorePointCollection(TrackedResource): """Create or update Restore Point collection parameters. 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar source: The properties of the source resource that this restore point collection is created from. :vartype source: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionSourceProperties @@ -6645,6 +6856,7 @@ class RestorePointCollection(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "provisioning_state": {"readonly": True}, "restore_point_collection_id": {"readonly": True}, @@ -6655,8 +6867,9 @@ class RestorePointCollection(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "source": {"key": "properties.source", "type": "RestorePointCollectionSourceProperties"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "restore_point_collection_id": {"key": "properties.restorePointCollectionId", "type": "str"}, @@ -6672,46 +6885,48 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword source: The properties of the source resource that this restore point collection is created from. :paramtype source: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionSourceProperties """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.source = source - self.provisioning_state = None - self.restore_point_collection_id = None - self.restore_points = None + self.provisioning_state: Optional[str] = None + self.restore_point_collection_id: Optional[str] = None + self.restore_points: Optional[List["_models.RestorePoint"]] = None class RestorePointCollectionListResult(_serialization.Model): """The List restore point collection operation response. - :ivar value: Gets the list of restore point collections. + All required parameters must be populated in order to send to server. + + :ivar value: Gets the list of restore point collections. Required. :vartype value: list[~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection] :ivar next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() with this to fetch the next page of RestorePointCollections. :vartype next_link: str """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { "value": {"key": "value", "type": "[RestorePointCollection]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.RestorePointCollection"]] = None, - next_link: Optional[str] = None, - **kwargs: Any + self, *, value: List["_models.RestorePointCollection"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: Gets the list of restore point collections. + :keyword value: Gets the list of restore point collections. Required. :paramtype value: list[~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection] :keyword next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() with this to fetch the next page of RestorePointCollections. @@ -6748,7 +6963,7 @@ def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylin :paramtype id: str """ super().__init__(**kwargs) - self.location = None + self.location: Optional[str] = None self.id = id @@ -6802,9 +7017,9 @@ def __init__( """ super().__init__(tags=tags, **kwargs) self.source = source - self.provisioning_state = None - self.restore_point_collection_id = None - self.restore_points = None + self.provisioning_state: Optional[str] = None + self.restore_point_collection_id: Optional[str] = None + self.restore_points: Optional[List["_models.RestorePoint"]] = None class RestorePointEncryption(_serialization.Model): @@ -6953,16 +7168,16 @@ def __init__( ~azure.mgmt.compute.v2024_11_01.models.RestorePointSourceVMStorageProfile """ super().__init__(**kwargs) - self.hardware_profile = None + self.hardware_profile: Optional["_models.HardwareProfile"] = None self.storage_profile = storage_profile - self.os_profile = None - self.diagnostics_profile = None - self.license_type = None - self.vm_id = None - self.security_profile = None - self.location = None - self.user_data = None - self.hyper_v_generation = None + self.os_profile: Optional["_models.OSProfile"] = None + self.diagnostics_profile: Optional["_models.DiagnosticsProfile"] = None + self.license_type: Optional[str] = None + self.vm_id: Optional[str] = None + self.security_profile: Optional["_models.SecurityProfile"] = None + self.location: Optional[str] = None + self.user_data: Optional[str] = None + self.hyper_v_generation: Optional[Union[str, "_models.HyperVGenerationTypes"]] = None class RestorePointSourceVMDataDisk(_serialization.Model): @@ -7020,13 +7235,13 @@ def __init__( ~azure.mgmt.compute.v2024_11_01.models.DiskRestorePointAttributes """ super().__init__(**kwargs) - self.lun = None - self.name = None - self.caching = None - self.disk_size_gb = None + self.lun: Optional[int] = None + self.name: Optional[str] = None + self.caching: Optional[Union[str, "_models.CachingTypes"]] = None + self.disk_size_gb: Optional[int] = None self.managed_disk = managed_disk self.disk_restore_point = disk_restore_point - self.write_accelerator_enabled = None + self.write_accelerator_enabled: Optional[bool] = None class RestorePointSourceVMOSDisk(_serialization.Model): @@ -7087,14 +7302,14 @@ def __init__( ~azure.mgmt.compute.v2024_11_01.models.DiskRestorePointAttributes """ super().__init__(**kwargs) - self.os_type = None - self.encryption_settings = None - self.name = None - self.caching = None - self.disk_size_gb = None + self.os_type: Optional[Union[str, "_models.OperatingSystemType"]] = None + self.encryption_settings: Optional["_models.DiskEncryptionSettings"] = None + self.name: Optional[str] = None + self.caching: Optional[Union[str, "_models.CachingTypes"]] = None + self.disk_size_gb: Optional[int] = None self.managed_disk = managed_disk self.disk_restore_point = disk_restore_point - self.write_accelerator_enabled = None + self.write_accelerator_enabled: Optional[bool] = None class RestorePointSourceVMStorageProfile(_serialization.Model): @@ -7142,7 +7357,7 @@ def __init__( super().__init__(**kwargs) self.os_disk = os_disk self.data_disks = data_disks - self.disk_controller_type = None + self.disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = None class RetrieveBootDiagnosticsDataResult(_serialization.Model): @@ -7169,8 +7384,8 @@ class RetrieveBootDiagnosticsDataResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.console_screenshot_blob_uri = None - self.serial_console_log_blob_uri = None + self.console_screenshot_blob_uri: Optional[str] = None + self.serial_console_log_blob_uri: Optional[str] = None class RollbackStatusInfo(_serialization.Model): @@ -7202,9 +7417,9 @@ class RollbackStatusInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successfully_rolledback_instance_count = None - self.failed_rolledback_instance_count = None - self.rollback_error = None + self.successfully_rolledback_instance_count: Optional[int] = None + self.failed_rolledback_instance_count: Optional[int] = None + self.rollback_error: Optional["_models.ApiError"] = None class RollingUpgradePolicy(_serialization.Model): @@ -7249,7 +7464,7 @@ class RollingUpgradePolicy(_serialization.Model): _validation = { "max_batch_instance_percent": {"maximum": 100, "minimum": 5}, "max_unhealthy_instance_percent": {"maximum": 100, "minimum": 5}, - "max_unhealthy_upgraded_instance_percent": {"maximum": 100, "minimum": 0}, + "max_unhealthy_upgraded_instance_percent": {"maximum": 100}, } _attribute_map = { @@ -7356,10 +7571,10 @@ class RollingUpgradeProgressInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.successful_instance_count = None - self.failed_instance_count = None - self.in_progress_instance_count = None - self.pending_instance_count = None + self.successful_instance_count: Optional[int] = None + self.failed_instance_count: Optional[int] = None + self.in_progress_instance_count: Optional[int] = None + self.pending_instance_count: Optional[int] = None class RollingUpgradeRunningStatus(_serialization.Model): @@ -7396,29 +7611,34 @@ class RollingUpgradeRunningStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.last_action = None - self.last_action_time = None + self.code: Optional[Union[str, "_models.RollingUpgradeStatusCode"]] = None + self.start_time: Optional[datetime.datetime] = None + self.last_action: Optional[Union[str, "_models.RollingUpgradeActionType"]] = None + self.last_action_time: Optional[datetime.datetime] = None -class RollingUpgradeStatusInfo(Resource): +class RollingUpgradeStatusInfo(TrackedResource): """The status of the latest virtual machine scale set rolling upgrade. 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar policy: The rolling upgrade policies applied for this upgrade. :vartype policy: ~azure.mgmt.compute.v2024_11_01.models.RollingUpgradePolicy :ivar running_status: Information about the current running state of the overall upgrade. @@ -7434,6 +7654,7 @@ class RollingUpgradeStatusInfo(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "policy": {"readonly": True}, "running_status": {"readonly": True}, @@ -7445,8 +7666,9 @@ class RollingUpgradeStatusInfo(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "policy": {"key": "properties.policy", "type": "RollingUpgradePolicy"}, "running_status": {"key": "properties.runningStatus", "type": "RollingUpgradeRunningStatus"}, "progress": {"key": "properties.progress", "type": "RollingUpgradeProgressInfo"}, @@ -7455,16 +7677,16 @@ class RollingUpgradeStatusInfo(Resource): def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str """ - super().__init__(location=location, tags=tags, **kwargs) - self.policy = None - self.running_status = None - self.progress = None - self.error = None + super().__init__(tags=tags, location=location, **kwargs) + self.policy: Optional["_models.RollingUpgradePolicy"] = None + self.running_status: Optional["_models.RollingUpgradeRunningStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None class RunCommandDocumentBase(_serialization.Model): @@ -7785,7 +8007,13 @@ class RunCommandParameterDefinition(_serialization.Model): } def __init__( - self, *, name: str, type: str, default_value: Optional[str] = None, required: bool = False, **kwargs: Any + self, + *, + name: str, + type: str, + default_value: Optional[str] = None, + required: Optional[bool] = None, + **kwargs: Any ) -> None: """ :keyword name: The run command parameter name. Required. @@ -8027,7 +8255,7 @@ class SecurityPostureReference(_serialization.Model): All required parameters must be populated in order to send to server. :ivar id: The security posture reference id in the form of - /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. # pylint: disable=line-too-long + /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. Required. :vartype id: str :ivar exclude_extensions: The list of virtual machine extension names to exclude when applying @@ -8057,7 +8285,7 @@ def __init__( ) -> None: """ :keyword id: The security posture reference id in the form of - /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. # pylint: disable=line-too-long + /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. Required. :paramtype id: str :keyword exclude_extensions: The list of virtual machine extension names to exclude when @@ -8076,7 +8304,7 @@ class SecurityPostureReferenceUpdate(_serialization.Model): """Specifies the security posture to be used in the scale set. Minimum api-version: 2023-03-01. :ivar id: The security posture reference id in the form of - /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. # pylint: disable=line-too-long + /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. :vartype id: str :ivar exclude_extensions: The list of virtual machine extension names to exclude when applying the security posture. @@ -8101,7 +8329,7 @@ def __init__( ) -> None: """ :keyword id: The security posture reference id in the form of - /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. # pylint: disable=line-too-long + /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. :paramtype id: str :keyword exclude_extensions: The list of virtual machine extension names to exclude when applying the security posture. @@ -8191,7 +8419,7 @@ class ServiceArtifactReference(_serialization.Model): machines in the scale set when using 'latest' image version. Minimum api-version: 2022-11-01. :ivar id: The service artifact reference id in the form of - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName}. :vartype id: str """ @@ -8202,7 +8430,7 @@ class ServiceArtifactReference(_serialization.Model): def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: The service artifact reference id in the form of - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName}. :paramtype id: str """ super().__init__(**kwargs) @@ -8296,10 +8524,6 @@ class SkuProfileVMSize(_serialization.Model): :vartype rank: int """ - _validation = { - "rank": {"minimum": 0}, - } - _attribute_map = { "name": {"key": "name", "type": "str"}, "rank": {"key": "rank", "type": "int"}, @@ -8446,7 +8670,7 @@ class SshPublicKeyGenerateKeyPairResult(_serialization.Model): through ssh. The public key is in ssh-rsa format. Required. :vartype public_key: str :ivar id: The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. Required. :vartype id: str """ @@ -8475,7 +8699,7 @@ def __init__( machine through ssh. The public key is in ssh-rsa format. Required. :paramtype public_key: str :keyword id: The ARM resource id in the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. Required. :paramtype id: str """ @@ -8485,23 +8709,28 @@ def __init__( self.id = id -class SshPublicKeyResource(Resource): +class SshPublicKeyResource(TrackedResource): """Specifies information about the SSH public key. 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar public_key: SSH public key used to authenticate to a virtual machine through ssh. If this property is not initially provided when the resource is created, the publicKey property will be populated when generateKeyPair is called. If the public key is provided upon resource creation, @@ -8513,6 +8742,7 @@ class SshPublicKeyResource(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, } @@ -8520,8 +8750,9 @@ class SshPublicKeyResource(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "public_key": {"key": "properties.publicKey", "type": "str"}, } @@ -8529,17 +8760,17 @@ def __init__( self, *, location: str, tags: Optional[Dict[str, str]] = None, public_key: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword public_key: SSH public key used to authenticate to a virtual machine through ssh. If this property is not initially provided when the resource is created, the publicKey property will be populated when generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format. :paramtype public_key: str """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.public_key = public_key @@ -8731,6 +8962,70 @@ def __init__( class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.compute.v2024_11_01.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.compute.v2024_11_01.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.compute.v2024_11_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.compute.v2024_11_01.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class SystemDataAutoGenerated(_serialization.Model): """The system meta data relating to this resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -8756,8 +9051,8 @@ class SystemData(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.created_at = None - self.last_modified_at = None + self.created_at: Optional[datetime.datetime] = None + self.last_modified_at: Optional[datetime.datetime] = None class TerminateNotificationProfile(_serialization.Model): @@ -8881,9 +9176,9 @@ class UpgradeOperationHistoricalStatusInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.properties = None - self.type = None - self.location = None + self.properties: Optional["_models.UpgradeOperationHistoricalStatusInfoProperties"] = None + self.type: Optional[str] = None + self.location: Optional[str] = None class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # pylint: disable=name-too-long @@ -8927,12 +9222,12 @@ class UpgradeOperationHistoricalStatusInfoProperties(_serialization.Model): # p def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.running_status = None - self.progress = None - self.error = None - self.started_by = None - self.target_image_reference = None - self.rollback_info = None + self.running_status: Optional["_models.UpgradeOperationHistoryStatus"] = None + self.progress: Optional["_models.RollingUpgradeProgressInfo"] = None + self.error: Optional["_models.ApiError"] = None + self.started_by: Optional[Union[str, "_models.UpgradeOperationInvoker"]] = None + self.target_image_reference: Optional["_models.ImageReference"] = None + self.rollback_info: Optional["_models.RollbackStatusInfo"] = None class UpgradeOperationHistoryStatus(_serialization.Model): @@ -8964,9 +9259,9 @@ class UpgradeOperationHistoryStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.start_time = None - self.end_time = None + self.code: Optional[Union[str, "_models.UpgradeState"]] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None class UpgradePolicy(_serialization.Model): @@ -9123,8 +9418,36 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None + + +class UserAssignedIdentitiesValueAutoGenerated(_serialization.Model): + """UserAssignedIdentitiesValueAutoGenerated. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class UserInitiatedReboot(_serialization.Model): @@ -9284,23 +9607,28 @@ def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: self.uri = uri -class VirtualMachine(Resource): +class VirtualMachine(TrackedResource): """Describes a Virtual Machine. 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar plan: Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find @@ -9311,7 +9639,7 @@ class VirtualMachine(Resource): :vartype resources: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :ivar identity: The identity of the virtual machine, if configured. :vartype identity: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineIdentity - :ivar zones: The virtual machine zones. + :ivar zones: The availability zones. :vartype zones: list[str] :ivar extended_location: The extended location of the Virtual Machine. :vartype extended_location: ~azure.mgmt.compute.v2024_11_01.models.ExtendedLocation @@ -9443,6 +9771,7 @@ class VirtualMachine(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "resources": {"readonly": True}, "managed_by": {"readonly": True}, @@ -9457,8 +9786,9 @@ class VirtualMachine(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "plan": {"key": "plan", "type": "Plan"}, "resources": {"key": "resources", "type": "[VirtualMachineExtension]"}, "identity": {"key": "identity", "type": "VirtualMachineIdentity"}, @@ -9532,10 +9862,10 @@ def __init__( # pylint: disable=too-many-locals **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword plan: Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find @@ -9544,7 +9874,7 @@ def __init__( # pylint: disable=too-many-locals :paramtype plan: ~azure.mgmt.compute.v2024_11_01.models.Plan :keyword identity: The identity of the virtual machine, if configured. :paramtype identity: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineIdentity - :keyword zones: The virtual machine zones. + :keyword zones: The availability zones. :paramtype zones: list[str] :keyword extended_location: The extended location of the Virtual Machine. :paramtype extended_location: ~azure.mgmt.compute.v2024_11_01.models.ExtendedLocation @@ -9656,14 +9986,14 @@ def __init__( # pylint: disable=too-many-locals to the VM/VMSS. :paramtype application_profile: ~azure.mgmt.compute.v2024_11_01.models.ApplicationProfile """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.plan = plan - self.resources = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None self.identity = identity self.zones = zones self.extended_location = extended_location - self.managed_by = None - self.etag = None + self.managed_by: Optional[str] = None + self.etag: Optional[str] = None self.placement = placement self.hardware_profile = hardware_profile self.scheduled_events_policy = scheduled_events_policy @@ -9681,17 +10011,17 @@ def __init__( # pylint: disable=too-many-locals self.billing_profile = billing_profile self.host = host self.host_group = host_group - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None self.extensions_time_budget = extensions_time_budget self.platform_fault_domain = platform_fault_domain self.scheduled_events_profile = scheduled_events_profile self.user_data = user_data self.capacity_reservation = capacity_reservation self.application_profile = application_profile - self.time_created = None + self.time_created: Optional[datetime.datetime] = None class VirtualMachineAgentInstanceView(_serialization.Model): @@ -9793,14 +10123,14 @@ class VirtualMachineAssessPatchesResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None - self.assessment_activity_id = None - self.reboot_pending = None - self.critical_and_security_patch_count = None - self.other_patch_count = None - self.start_date_time = None - self.available_patches = None - self.error = None + self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None + self.assessment_activity_id: Optional[str] = None + self.reboot_pending: Optional[bool] = None + self.critical_and_security_patch_count: Optional[int] = None + self.other_patch_count: Optional[int] = None + self.start_date_time: Optional[datetime.datetime] = None + self.available_patches: Optional[List["_models.VirtualMachineSoftwarePatchProperties"]] = None + self.error: Optional["_models.ApiError"] = None class VirtualMachineCaptureParameters(_serialization.Model): @@ -9859,9 +10189,9 @@ class VirtualMachineCaptureResult(SubResource): :ivar content_version: the version of the content. :vartype content_version: str :ivar parameters: parameters of the captured virtual machine. - :vartype parameters: JSON + :vartype parameters: any :ivar resources: a list of resource items of the captured virtual machine. - :vartype resources: list[JSON] + :vartype resources: list[any] """ _validation = { @@ -9885,27 +10215,34 @@ def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylin :paramtype id: str """ super().__init__(id=id, **kwargs) - self.schema = None - self.content_version = None - self.parameters = None - self.resources = None + self.schema: Optional[str] = None + self.content_version: Optional[str] = None + self.parameters: Optional[Any] = None + self.resources: Optional[List[Any]] = None -class VirtualMachineExtension(ResourceWithOptionalLocation): +class VirtualMachineExtension(TrackedResource): """Describes a Virtual Machine Extension. Variables are only populated by the server, and will be ignored when sending a request. - :ivar location: Resource location. - :vartype location: str - :ivar id: Resource Id. + 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}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. :vartype force_update_tag: str @@ -9924,10 +10261,10 @@ class VirtualMachineExtension(ResourceWithOptionalLocation): upgraded by the platform if there is a newer version of the extension available. :vartype enable_automatic_upgrade: bool :ivar settings: Json formatted public settings for the extension. - :vartype settings: JSON + :vartype settings: any :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON + :vartype protected_settings: any :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str :ivar instance_view: The virtual machine extension instance view. @@ -9950,15 +10287,18 @@ class VirtualMachineExtension(ResourceWithOptionalLocation): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, "provisioning_state": {"readonly": True}, } _attribute_map = { - "location": {"key": "location", "type": "str"}, "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, "publisher": {"key": "properties.publisher", "type": "str"}, "type_properties_type": {"key": "properties.type", "type": "str"}, @@ -9980,7 +10320,7 @@ class VirtualMachineExtension(ResourceWithOptionalLocation): def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, force_update_tag: Optional[str] = None, publisher: Optional[str] = None, @@ -9988,8 +10328,8 @@ def __init__( type_handler_version: Optional[str] = None, auto_upgrade_minor_version: Optional[bool] = None, enable_automatic_upgrade: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, instance_view: Optional["_models.VirtualMachineExtensionInstanceView"] = None, suppress_failures: Optional[bool] = None, protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = None, @@ -9997,10 +10337,10 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: Resource location. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. :paramtype force_update_tag: str @@ -10019,10 +10359,10 @@ def __init__( upgraded by the platform if there is a newer version of the extension available. :paramtype enable_automatic_upgrade: bool :keyword settings: Json formatted public settings for the extension. - :paramtype settings: JSON + :paramtype settings: any :keyword protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON + :paramtype protected_settings: any :keyword instance_view: The virtual machine extension instance view. :paramtype instance_view: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionInstanceView @@ -10038,7 +10378,7 @@ def __init__( needs to be provisioned. :paramtype provision_after_extensions: list[str] """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -10047,7 +10387,7 @@ def __init__( self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.instance_view = instance_view self.suppress_failures = suppress_failures self.protected_settings_from_key_vault = protected_settings_from_key_vault @@ -10093,23 +10433,28 @@ def __init__( self.status = status -class VirtualMachineExtensionImage(Resource): +class VirtualMachineExtensionImage(TrackedResource): """Describes a Virtual Machine Extension Image. 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar operating_system: The operating system this extension supports. :vartype operating_system: str :ivar compute_role: The type of role (IaaS or PaaS) this extension supports. @@ -10129,6 +10474,7 @@ class VirtualMachineExtensionImage(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, } @@ -10136,8 +10482,9 @@ class VirtualMachineExtensionImage(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "operating_system": {"key": "properties.operatingSystem", "type": "str"}, "compute_role": {"key": "properties.computeRole", "type": "str"}, "handler_schema": {"key": "properties.handlerSchema", "type": "str"}, @@ -10158,10 +10505,10 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword operating_system: The operating system this extension supports. :paramtype operating_system: str :keyword compute_role: The type of role (IaaS or PaaS) this extension supports. @@ -10176,7 +10523,7 @@ def __init__( :keyword supports_multiple_extensions: Whether the handler can support multiple extensions. :paramtype supports_multiple_extensions: bool """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.operating_system = operating_system self.compute_role = compute_role self.handler_schema = handler_schema @@ -10279,10 +10626,10 @@ class VirtualMachineExtensionUpdate(UpdateResource): upgraded by the platform if there is a newer version of the extension available. :vartype enable_automatic_upgrade: bool :ivar settings: Json formatted public settings for the extension. - :vartype settings: JSON + :vartype settings: any :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON + :vartype protected_settings: any :ivar suppress_failures: Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. @@ -10320,8 +10667,8 @@ def __init__( type_handler_version: Optional[str] = None, auto_upgrade_minor_version: Optional[bool] = None, enable_automatic_upgrade: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, suppress_failures: Optional[bool] = None, protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = None, **kwargs: Any @@ -10346,10 +10693,10 @@ def __init__( upgraded by the platform if there is a newer version of the extension available. :paramtype enable_automatic_upgrade: bool :keyword settings: Json formatted public settings for the extension. - :paramtype settings: JSON + :paramtype settings: any :keyword protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON + :paramtype protected_settings: any :keyword suppress_failures: Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. @@ -10392,7 +10739,7 @@ class VirtualMachineHealthStatus(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None + self.status: Optional["_models.InstanceViewStatus"] = None class VirtualMachineIdentity(_serialization.Model): @@ -10413,7 +10760,7 @@ class VirtualMachineIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.compute.v2024_11_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2024_11_01.models.UserAssignedIdentitiesValue] """ @@ -10445,13 +10792,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.compute.v2024_11_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2024_11_01.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -10541,7 +10888,7 @@ class VirtualMachineImage(VirtualMachineImageResource): :vartype plan: ~azure.mgmt.compute.v2024_11_01.models.PurchasePlan :ivar os_disk_image: Contains the os disk image information. :vartype os_disk_image: ~azure.mgmt.compute.v2024_11_01.models.OSDiskImage - :ivar data_disk_images: + :ivar data_disk_images: The list of data disk images information. :vartype data_disk_images: list[~azure.mgmt.compute.v2024_11_01.models.DataDiskImage] :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. :vartype automatic_os_upgrade_properties: @@ -10623,7 +10970,7 @@ def __init__( :paramtype plan: ~azure.mgmt.compute.v2024_11_01.models.PurchasePlan :keyword os_disk_image: Contains the os disk image information. :paramtype os_disk_image: ~azure.mgmt.compute.v2024_11_01.models.OSDiskImage - :keyword data_disk_images: + :keyword data_disk_images: The list of data disk images information. :paramtype data_disk_images: list[~azure.mgmt.compute.v2024_11_01.models.DataDiskImage] :keyword automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. @@ -10685,10 +11032,9 @@ def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, * class VirtualMachineImagesWithPropertiesListResult(_serialization.Model): # pylint: disable=name-too-long """The List Virtual Machine Images operation response. - :ivar value: The list of virtual machine images. + :ivar value: The VirtualMachineImage items on this page. :vartype value: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage] - :ivar next_link: The URI to fetch the next page of virtual machine images. Call ListNext() with - this URI to fetch the next page of virtual machine images. + :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -10705,10 +11051,9 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword value: The list of virtual machine images. + :keyword value: The VirtualMachineImage items on this page. :paramtype value: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage] - :keyword next_link: The URI to fetch the next page of virtual machine images. Call ListNext() - with this URI to fetch the next page of virtual machine images. + :keyword next_link: The link to the next page of items. :paramtype next_link: str """ super().__init__(**kwargs) @@ -10723,7 +11068,7 @@ class VirtualMachineInstallPatchesParameters(_serialization.Model): :ivar maximum_duration: Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such as PT4H (4 hours). - :vartype maximum_duration: str + :vartype maximum_duration: ~datetime.timedelta :ivar reboot_setting: Defines when it is acceptable to reboot a VM during a software update operation. Required. Known values are: "IfRequired", "Never", and "Always". :vartype reboot_setting: str or @@ -10741,7 +11086,7 @@ class VirtualMachineInstallPatchesParameters(_serialization.Model): } _attribute_map = { - "maximum_duration": {"key": "maximumDuration", "type": "str"}, + "maximum_duration": {"key": "maximumDuration", "type": "duration"}, "reboot_setting": {"key": "rebootSetting", "type": "str"}, "windows_parameters": {"key": "windowsParameters", "type": "WindowsParameters"}, "linux_parameters": {"key": "linuxParameters", "type": "LinuxParameters"}, @@ -10751,7 +11096,7 @@ def __init__( self, *, reboot_setting: Union[str, "_models.VMGuestPatchRebootSetting"], - maximum_duration: Optional[str] = None, + maximum_duration: Optional[datetime.timedelta] = None, windows_parameters: Optional["_models.WindowsParameters"] = None, linux_parameters: Optional["_models.LinuxParameters"] = None, **kwargs: Any @@ -10759,7 +11104,7 @@ def __init__( """ :keyword maximum_duration: Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such as PT4H (4 hours). - :paramtype maximum_duration: str + :paramtype maximum_duration: ~datetime.timedelta :keyword reboot_setting: Defines when it is acceptable to reboot a VM during a software update operation. Required. Known values are: "IfRequired", "Never", and "Always". :paramtype reboot_setting: str or @@ -10854,18 +11199,18 @@ class VirtualMachineInstallPatchesResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.status = None - self.installation_activity_id = None - self.reboot_status = None - self.maintenance_window_exceeded = None - self.excluded_patch_count = None - self.not_selected_patch_count = None - self.pending_patch_count = None - self.installed_patch_count = None - self.failed_patch_count = None - self.patches = None - self.start_date_time = None - self.error = None + self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None + self.installation_activity_id: Optional[str] = None + self.reboot_status: Optional[Union[str, "_models.VMGuestPatchRebootStatus"]] = None + self.maintenance_window_exceeded: Optional[bool] = None + self.excluded_patch_count: Optional[int] = None + self.not_selected_patch_count: Optional[int] = None + self.pending_patch_count: Optional[int] = None + self.installed_patch_count: Optional[int] = None + self.failed_patch_count: Optional[int] = None + self.patches: Optional[List["_models.PatchInstallationDetail"]] = None + self.start_date_time: Optional[datetime.datetime] = None + self.error: Optional["_models.ApiError"] = None class VirtualMachineInstanceView(_serialization.Model): @@ -10898,8 +11243,7 @@ class VirtualMachineInstanceView(_serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The application health status for the VM, provided through Application Health - Extension. + :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineHealthStatus :ivar boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. You can easily view the output of your @@ -11011,12 +11355,12 @@ def __init__( self.maintenance_redeploy_status = maintenance_redeploy_status self.disks = disks self.extensions = extensions - self.vm_health = None + self.vm_health: Optional["_models.VirtualMachineHealthStatus"] = None self.boot_diagnostics = boot_diagnostics - self.assigned_host = None + self.assigned_host: Optional[str] = None self.statuses = statuses self.patch_status = patch_status - self.is_vm_in_standby_pool = None + self.is_vm_in_standby_pool: Optional[bool] = None class VirtualMachineIpTag(_serialization.Model): @@ -11408,7 +11752,7 @@ def __init__( super().__init__(**kwargs) self.available_patch_summary = available_patch_summary self.last_patch_installation_summary = last_patch_installation_summary - self.configuration_statuses = None + self.configuration_statuses: Optional[List["_models.InstanceViewStatus"]] = None class VirtualMachinePublicIPAddressConfiguration(_serialization.Model): # pylint: disable=name-too-long @@ -11610,23 +11954,28 @@ def __init__( self.os_profile = os_profile -class VirtualMachineRunCommand(Resource): +class VirtualMachineRunCommand(TrackedResource): """Describes a Virtual Machine run command. 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar source: The source of the run command script. :vartype source: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandScriptSource :ivar parameters: The parameters used by the script. @@ -11692,6 +12041,7 @@ class VirtualMachineRunCommand(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "provisioning_state": {"readonly": True}, "instance_view": {"readonly": True}, @@ -11701,8 +12051,9 @@ class VirtualMachineRunCommand(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "source": {"key": "properties.source", "type": "VirtualMachineRunCommandScriptSource"}, "parameters": {"key": "properties.parameters", "type": "[RunCommandInputParameter]"}, "protected_parameters": {"key": "properties.protectedParameters", "type": "[RunCommandInputParameter]"}, @@ -11733,7 +12084,7 @@ def __init__( source: Optional["_models.VirtualMachineRunCommandScriptSource"] = None, parameters: Optional[List["_models.RunCommandInputParameter"]] = None, protected_parameters: Optional[List["_models.RunCommandInputParameter"]] = None, - async_execution: bool = False, + async_execution: Optional[bool] = None, run_as_user: Optional[str] = None, run_as_password: Optional[str] = None, timeout_in_seconds: Optional[int] = None, @@ -11741,14 +12092,14 @@ def __init__( error_blob_uri: Optional[str] = None, output_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, error_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, - treat_failure_as_deployment_failure: bool = False, + treat_failure_as_deployment_failure: Optional[bool] = None, **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword source: The source of the run command script. :paramtype source: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandScriptSource :keyword parameters: The parameters used by the script. @@ -11798,7 +12149,7 @@ def __init__( error: https://aka.ms/runcommandmanaged#get-execution-status-and-results. :paramtype treat_failure_as_deployment_failure: bool """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.source = source self.parameters = parameters self.protected_parameters = protected_parameters @@ -11810,8 +12161,8 @@ def __init__( self.error_blob_uri = error_blob_uri self.output_blob_managed_identity = output_blob_managed_identity self.error_blob_managed_identity = error_blob_managed_identity - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineRunCommandInstanceView"] = None self.treat_failure_as_deployment_failure = treat_failure_as_deployment_failure @@ -12089,7 +12440,7 @@ def __init__( source: Optional["_models.VirtualMachineRunCommandScriptSource"] = None, parameters: Optional[List["_models.RunCommandInputParameter"]] = None, protected_parameters: Optional[List["_models.RunCommandInputParameter"]] = None, - async_execution: bool = False, + async_execution: Optional[bool] = None, run_as_user: Optional[str] = None, run_as_password: Optional[str] = None, timeout_in_seconds: Optional[int] = None, @@ -12097,7 +12448,7 @@ def __init__( error_blob_uri: Optional[str] = None, output_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, error_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, - treat_failure_as_deployment_failure: bool = False, + treat_failure_as_deployment_failure: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -12164,28 +12515,33 @@ def __init__( self.error_blob_uri = error_blob_uri self.output_blob_managed_identity = output_blob_managed_identity self.error_blob_managed_identity = error_blob_managed_identity - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineRunCommandInstanceView"] = None self.treat_failure_as_deployment_failure = treat_failure_as_deployment_failure -class VirtualMachineScaleSet(Resource): +class VirtualMachineScaleSet(TrackedResource): """Describes a Virtual Machine Scale Set. 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar sku: The virtual machine scale set sku. :vartype sku: ~azure.mgmt.compute.v2024_11_01.models.Sku :ivar plan: Specifies information about the marketplace image used to create the virtual @@ -12196,7 +12552,7 @@ class VirtualMachineScaleSet(Resource): :vartype plan: ~azure.mgmt.compute.v2024_11_01.models.Plan :ivar identity: The identity of the virtual machine scale set, if configured. :vartype identity: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetIdentity - :ivar zones: The virtual machine scale set zones. + :ivar zones: The availability zones. :vartype zones: list[str] :ivar extended_location: The extended location of the Virtual Machine Scale Set. :vartype extended_location: ~azure.mgmt.compute.v2024_11_01.models.ExtendedLocation @@ -12277,6 +12633,7 @@ class VirtualMachineScaleSet(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "etag": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -12288,8 +12645,9 @@ class VirtualMachineScaleSet(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "sku": {"key": "sku", "type": "Sku"}, "plan": {"key": "plan", "type": "Plan"}, "identity": {"key": "identity", "type": "VirtualMachineScaleSetIdentity"}, @@ -12365,10 +12723,10 @@ def __init__( # pylint: disable=too-many-locals **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword sku: The virtual machine scale set sku. :paramtype sku: ~azure.mgmt.compute.v2024_11_01.models.Sku :keyword plan: Specifies information about the marketplace image used to create the virtual @@ -12379,7 +12737,7 @@ def __init__( # pylint: disable=too-many-locals :paramtype plan: ~azure.mgmt.compute.v2024_11_01.models.Plan :keyword identity: The identity of the virtual machine scale set, if configured. :paramtype identity: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetIdentity - :keyword zones: The virtual machine scale set zones. + :keyword zones: The availability zones. :paramtype zones: list[str] :keyword extended_location: The extended location of the Virtual Machine Scale Set. :paramtype extended_location: ~azure.mgmt.compute.v2024_11_01.models.ExtendedLocation @@ -12449,21 +12807,21 @@ def __init__( # pylint: disable=too-many-locals :keyword sku_profile: Specifies the sku profile for the virtual machine scale set. :paramtype sku_profile: ~azure.mgmt.compute.v2024_11_01.models.SkuProfile """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.plan = plan self.identity = identity self.zones = zones self.extended_location = extended_location - self.etag = None + self.etag: Optional[str] = None self.upgrade_policy = upgrade_policy self.scheduled_events_policy = scheduled_events_policy self.automatic_repairs_policy = automatic_repairs_policy self.virtual_machine_profile = virtual_machine_profile - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.overprovision = overprovision self.do_not_run_extensions_on_overprovisioned_v_ms = do_not_run_extensions_on_overprovisioned_v_ms - self.unique_id = None + self.unique_id: Optional[str] = None self.single_placement_group = single_placement_group self.zone_balance = zone_balance self.platform_fault_domain_count = platform_fault_domain_count @@ -12474,7 +12832,7 @@ def __init__( # pylint: disable=too-many-locals self.orchestration_mode = orchestration_mode self.spot_restore_policy = spot_restore_policy self.priority_mix_policy = priority_mix_policy - self.time_created = None + self.time_created: Optional[datetime.datetime] = None self.constrained_maximum_capacity = constrained_maximum_capacity self.resiliency_policy = resiliency_policy self.zonal_platform_fault_domain_align_mode = zonal_platform_fault_domain_align_mode @@ -12621,10 +12979,10 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :ivar name: The name of the extension. - :vartype name: str :ivar type: Resource type. :vartype type: str + :ivar vm_name: Resource name. + :vartype vm_name: str :ivar force_update_tag: If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. :vartype force_update_tag: str @@ -12643,10 +13001,10 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): upgraded by the platform if there is a newer version of the extension available. :vartype enable_automatic_upgrade: bool :ivar settings: Json formatted public settings for the extension. - :vartype settings: JSON + :vartype settings: any :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON + :vartype protected_settings: any :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str :ivar provision_after_extensions: Collection of extension names after which this extension @@ -12670,8 +13028,8 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): _attribute_map = { "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "vm_name": {"key": "name", "type": "str"}, "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, "publisher": {"key": "properties.publisher", "type": "str"}, "type_properties_type": {"key": "properties.type", "type": "str"}, @@ -12692,23 +13050,23 @@ class VirtualMachineScaleSetExtension(SubResourceReadOnly): def __init__( self, *, - name: Optional[str] = None, + vm_name: Optional[str] = None, force_update_tag: Optional[str] = None, publisher: Optional[str] = None, type_properties_type: Optional[str] = None, type_handler_version: Optional[str] = None, auto_upgrade_minor_version: Optional[bool] = None, enable_automatic_upgrade: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, provision_after_extensions: Optional[List[str]] = None, suppress_failures: Optional[bool] = None, protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = None, **kwargs: Any ) -> None: """ - :keyword name: The name of the extension. - :paramtype name: str + :keyword vm_name: Resource name. + :paramtype vm_name: str :keyword force_update_tag: If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. :paramtype force_update_tag: str @@ -12727,10 +13085,10 @@ def __init__( upgraded by the platform if there is a newer version of the extension available. :paramtype enable_automatic_upgrade: bool :keyword settings: Json formatted public settings for the extension. - :paramtype settings: JSON + :paramtype settings: any :keyword protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON + :paramtype protected_settings: any :keyword provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. :paramtype provision_after_extensions: list[str] @@ -12744,8 +13102,8 @@ def __init__( ~azure.mgmt.compute.v2024_11_01.models.KeyVaultSecretReference """ super().__init__(**kwargs) - self.name = name - self.type = None + self.type: Optional[str] = None + self.vm_name = vm_name self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -12754,7 +13112,7 @@ def __init__( self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.provision_after_extensions = provision_after_extensions self.suppress_failures = suppress_failures self.protected_settings_from_key_vault = protected_settings_from_key_vault @@ -12863,10 +13221,10 @@ class VirtualMachineScaleSetExtensionUpdate(SubResourceReadOnly): upgraded by the platform if there is a newer version of the extension available. :vartype enable_automatic_upgrade: bool :ivar settings: Json formatted public settings for the extension. - :vartype settings: JSON + :vartype settings: any :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON + :vartype protected_settings: any :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str :ivar provision_after_extensions: Collection of extension names after which this extension @@ -12919,8 +13277,8 @@ def __init__( type_handler_version: Optional[str] = None, auto_upgrade_minor_version: Optional[bool] = None, enable_automatic_upgrade: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, provision_after_extensions: Optional[List[str]] = None, suppress_failures: Optional[bool] = None, protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = None, @@ -12945,10 +13303,10 @@ def __init__( upgraded by the platform if there is a newer version of the extension available. :paramtype enable_automatic_upgrade: bool :keyword settings: Json formatted public settings for the extension. - :paramtype settings: JSON + :paramtype settings: any :keyword protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON + :paramtype protected_settings: any :keyword provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. :paramtype provision_after_extensions: list[str] @@ -12962,8 +13320,8 @@ def __init__( ~azure.mgmt.compute.v2024_11_01.models.KeyVaultSecretReference """ super().__init__(**kwargs) - self.name = None - self.type = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -12972,7 +13330,7 @@ def __init__( self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.provision_after_extensions = provision_after_extensions self.suppress_failures = suppress_failures self.protected_settings_from_key_vault = protected_settings_from_key_vault @@ -13021,7 +13379,7 @@ class VirtualMachineScaleSetIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.compute.v2024_11_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2024_11_01.models.UserAssignedIdentitiesValue] """ @@ -13055,13 +13413,13 @@ def __init__( :keyword user_assigned_identities: The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.compute.v2024_11_01.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -13103,10 +13461,10 @@ def __init__(self, *, statuses: Optional[List["_models.InstanceViewStatus"]] = N :paramtype statuses: list[~azure.mgmt.compute.v2024_11_01.models.InstanceViewStatus] """ super().__init__(**kwargs) - self.virtual_machine = None - self.extensions = None + self.virtual_machine: Optional["_models.VirtualMachineScaleSetInstanceViewStatusesSummary"] = None + self.extensions: Optional[List["_models.VirtualMachineScaleSetVMExtensionsSummary"]] = None self.statuses = statuses - self.orchestration_services = None + self.orchestration_services: Optional[List["_models.OrchestrationServiceSummary"]] = None class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): # pylint: disable=name-too-long @@ -13130,7 +13488,7 @@ class VirtualMachineScaleSetInstanceViewStatusesSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.statuses_summary = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetIPConfiguration(_serialization.Model): @@ -13519,8 +13877,8 @@ class VirtualMachineScaleSetMigrationInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.default_virtual_machine_scale_set_info = None - self.migrate_to_virtual_machine_scale_set = None + self.default_virtual_machine_scale_set_info: Optional["_models.DefaultVirtualMachineScaleSetInfo"] = None + self.migrate_to_virtual_machine_scale_set: Optional["_models.SubResource"] = None class VirtualMachineScaleSetNetworkConfiguration(_serialization.Model): # pylint: disable=name-too-long @@ -13679,15 +14037,14 @@ class VirtualMachineScaleSetNetworkProfile(_serialization.Model): :ivar health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :vartype health_probe: ~azure.mgmt.compute.v2024_11_01.models.ApiEntityReference :ivar network_interface_configurations: The list of network configurations. :vartype network_interface_configurations: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetNetworkConfiguration] - :ivar network_api_version: Specifies the Microsoft.Network API version used when creating + :ivar network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with - orchestration mode 'Flexible'. For support of all network properties, use '2022-11-01'. Known - values are: "2020-11-01" and "2022-11-01". + orchestration mode 'Flexible'. Known values are: "2020-11-01" and "2022-11-01". :vartype network_api_version: str or ~azure.mgmt.compute.v2024_11_01.models.NetworkApiVersion """ @@ -13711,15 +14068,14 @@ def __init__( """ :keyword health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :paramtype health_probe: ~azure.mgmt.compute.v2024_11_01.models.ApiEntityReference :keyword network_interface_configurations: The list of network configurations. :paramtype network_interface_configurations: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetNetworkConfiguration] - :keyword network_api_version: Specifies the Microsoft.Network API version used when creating + :keyword network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with - orchestration mode 'Flexible'. For support of all network properties, use '2022-11-01'. Known - values are: "2020-11-01" and "2022-11-01". + orchestration mode 'Flexible'. Known values are: "2020-11-01" and "2022-11-01". :paramtype network_api_version: str or ~azure.mgmt.compute.v2024_11_01.models.NetworkApiVersion """ super().__init__(**kwargs) @@ -14316,9 +14672,9 @@ class VirtualMachineScaleSetSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.resource_type = None - self.sku = None - self.capacity = None + self.resource_type: Optional[str] = None + self.sku: Optional["_models.Sku"] = None + self.capacity: Optional["_models.VirtualMachineScaleSetSkuCapacity"] = None class VirtualMachineScaleSetSkuCapacity(_serialization.Model): @@ -14355,10 +14711,10 @@ class VirtualMachineScaleSetSkuCapacity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default_capacity = None - self.scale_type = None + self.minimum: Optional[int] = None + self.maximum: Optional[int] = None + self.default_capacity: Optional[int] = None + self.scale_type: Optional[Union[str, "_models.VirtualMachineScaleSetSkuScaleType"]] = None class VirtualMachineScaleSetStorageProfile(_serialization.Model): @@ -14380,8 +14736,11 @@ class VirtualMachineScaleSetStorageProfile(_serialization.Model): `_. :vartype data_disks: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetDataDisk] - :ivar disk_controller_type: - :vartype disk_controller_type: str + :ivar disk_controller_type: Specifies the disk controller type configured for the virtual + machines in the scale set. Minimum api-version: 2022-08-01. Known values are: "SCSI" and + "NVMe". + :vartype disk_controller_type: str or + ~azure.mgmt.compute.v2024_11_01.models.DiskControllerTypes """ _attribute_map = { @@ -14397,7 +14756,7 @@ def __init__( image_reference: Optional["_models.ImageReference"] = None, os_disk: Optional["_models.VirtualMachineScaleSetOSDisk"] = None, data_disks: Optional[List["_models.VirtualMachineScaleSetDataDisk"]] = None, - disk_controller_type: Optional[str] = None, + disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = None, **kwargs: Any ) -> None: """ @@ -14417,8 +14776,11 @@ def __init__( `_. :paramtype data_disks: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetDataDisk] - :keyword disk_controller_type: - :paramtype disk_controller_type: str + :keyword disk_controller_type: Specifies the disk controller type configured for the virtual + machines in the scale set. Minimum api-version: 2022-08-01. Known values are: "SCSI" and + "NVMe". + :paramtype disk_controller_type: str or + ~azure.mgmt.compute.v2024_11_01.models.DiskControllerTypes """ super().__init__(**kwargs) self.image_reference = image_reference @@ -14868,15 +15230,14 @@ class VirtualMachineScaleSetUpdateNetworkProfile(_serialization.Model): # pylin :ivar health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :vartype health_probe: ~azure.mgmt.compute.v2024_11_01.models.ApiEntityReference :ivar network_interface_configurations: The list of network configurations. :vartype network_interface_configurations: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] - :ivar network_api_version: Specifies the Microsoft.Network API version used when creating + :ivar network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with - orchestration mode 'Flexible'. For support of all network properties, use '2022-11-01'. Known - values are: "2020-11-01" and "2022-11-01". + orchestration mode 'Flexible'. Known values are: "2020-11-01" and "2022-11-01". :vartype network_api_version: str or ~azure.mgmt.compute.v2024_11_01.models.NetworkApiVersion """ @@ -14902,15 +15263,14 @@ def __init__( """ :keyword health_probe: A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. :paramtype health_probe: ~azure.mgmt.compute.v2024_11_01.models.ApiEntityReference :keyword network_interface_configurations: The list of network configurations. :paramtype network_interface_configurations: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] - :keyword network_api_version: Specifies the Microsoft.Network API version used when creating + :keyword network_api_version: specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with - orchestration mode 'Flexible'. For support of all network properties, use '2022-11-01'. Known - values are: "2020-11-01" and "2022-11-01". + orchestration mode 'Flexible'. Known values are: "2020-11-01" and "2022-11-01". :paramtype network_api_version: str or ~azure.mgmt.compute.v2024_11_01.models.NetworkApiVersion """ super().__init__(**kwargs) @@ -15140,8 +15500,12 @@ class VirtualMachineScaleSetUpdateStorageProfile(_serialization.Model): # pylin :ivar data_disks: The data disks. :vartype data_disks: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetDataDisk] - :ivar disk_controller_type: - :vartype disk_controller_type: str + :ivar disk_controller_type: Specifies the disk controller type configured for the virtual + machines in the scale set. **Note:** You need to deallocate the virtual machines in the scale + set before updating its disk controller type based on the upgrade mode configured for the scale + set. Minimum api-version: 2022-08-01. Known values are: "SCSI" and "NVMe". + :vartype disk_controller_type: str or + ~azure.mgmt.compute.v2024_11_01.models.DiskControllerTypes """ _attribute_map = { @@ -15157,7 +15521,7 @@ def __init__( image_reference: Optional["_models.ImageReference"] = None, os_disk: Optional["_models.VirtualMachineScaleSetUpdateOSDisk"] = None, data_disks: Optional[List["_models.VirtualMachineScaleSetDataDisk"]] = None, - disk_controller_type: Optional[str] = None, + disk_controller_type: Optional[Union[str, "_models.DiskControllerTypes"]] = None, **kwargs: Any ) -> None: """ @@ -15168,8 +15532,12 @@ def __init__( :keyword data_disks: The data disks. :paramtype data_disks: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetDataDisk] - :keyword disk_controller_type: - :paramtype disk_controller_type: str + :keyword disk_controller_type: Specifies the disk controller type configured for the virtual + machines in the scale set. **Note:** You need to deallocate the virtual machines in the scale + set before updating its disk controller type based on the upgrade mode configured for the scale + set. Minimum api-version: 2022-08-01. Known values are: "SCSI" and "NVMe". + :paramtype disk_controller_type: str or + ~azure.mgmt.compute.v2024_11_01.models.DiskControllerTypes """ super().__init__(**kwargs) self.image_reference = image_reference @@ -15300,23 +15668,28 @@ def __init__( self.hardware_profile = hardware_profile -class VirtualMachineScaleSetVM(Resource): +class VirtualMachineScaleSetVM(TrackedResource): """Describes a virtual machine scale set virtual machine. 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 server. - :ivar id: Resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.compute.v2024_11_01.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar instance_id: The virtual machine instance ID. :vartype instance_id: str :ivar sku: The virtual machine SKU. @@ -15412,6 +15785,7 @@ class VirtualMachineScaleSetVM(Resource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, "instance_id": {"readonly": True}, "sku": {"readonly": True}, @@ -15430,8 +15804,9 @@ class VirtualMachineScaleSetVM(Resource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "instance_id": {"key": "instanceId", "type": "str"}, "sku": {"key": "sku", "type": "Sku"}, "plan": {"key": "plan", "type": "Plan"}, @@ -15486,10 +15861,10 @@ def __init__( # pylint: disable=too-many-locals **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword plan: Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find @@ -15554,17 +15929,17 @@ def __init__( # pylint: disable=too-many-locals pass any secrets in here. Minimum api-version: 2021-03-01. :paramtype user_data: str """ - super().__init__(location=location, tags=tags, **kwargs) - self.instance_id = None - self.sku = None + super().__init__(tags=tags, location=location, **kwargs) + self.instance_id: Optional[str] = None + self.sku: Optional["_models.Sku"] = None self.plan = plan - self.resources = None - self.zones = None + self.resources: Optional[List["_models.VirtualMachineExtension"]] = None + self.zones: Optional[List[str]] = None self.identity = identity - self.etag = None - self.latest_model_applied = None - self.vm_id = None - self.instance_view = None + self.etag: Optional[str] = None + self.latest_model_applied: Optional[bool] = None + self.vm_id: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineScaleSetVMInstanceView"] = None self.hardware_profile = hardware_profile self.resilient_vm_deletion_status = resilient_vm_deletion_status self.storage_profile = storage_profile @@ -15575,12 +15950,12 @@ def __init__( # pylint: disable=too-many-locals self.network_profile_configuration = network_profile_configuration self.diagnostics_profile = diagnostics_profile self.availability_set = availability_set - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.license_type = license_type - self.model_definition_applied = None + self.model_definition_applied: Optional[str] = None self.protection_policy = protection_policy self.user_data = user_data - self.time_created = None + self.time_created: Optional[datetime.datetime] = None class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): @@ -15590,12 +15965,12 @@ class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): :ivar id: Resource Id. :vartype id: str - :ivar name: The name of the extension. - :vartype name: str - :ivar type: Resource type. - :vartype type: str :ivar location: The location of the extension. :vartype location: str + :ivar type: Resource type. + :vartype type: str + :ivar vm_name: Resource name. + :vartype vm_name: str :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. :vartype force_update_tag: str @@ -15614,10 +15989,10 @@ class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): upgraded by the platform if there is a newer version of the extension available. :vartype enable_automatic_upgrade: bool :ivar settings: Json formatted public settings for the extension. - :vartype settings: JSON + :vartype settings: any :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON + :vartype protected_settings: any :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str :ivar instance_view: The virtual machine extension instance view. @@ -15638,16 +16013,16 @@ class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): _validation = { "id": {"readonly": True}, - "name": {"readonly": True}, "type": {"readonly": True}, + "vm_name": {"readonly": True}, "provisioning_state": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "vm_name": {"key": "name", "type": "str"}, "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, "publisher": {"key": "properties.publisher", "type": "str"}, "type_properties_type": {"key": "properties.type", "type": "str"}, @@ -15676,8 +16051,8 @@ def __init__( type_handler_version: Optional[str] = None, auto_upgrade_minor_version: Optional[bool] = None, enable_automatic_upgrade: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, instance_view: Optional["_models.VirtualMachineExtensionInstanceView"] = None, suppress_failures: Optional[bool] = None, protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = None, @@ -15705,10 +16080,10 @@ def __init__( upgraded by the platform if there is a newer version of the extension available. :paramtype enable_automatic_upgrade: bool :keyword settings: Json formatted public settings for the extension. - :paramtype settings: JSON + :paramtype settings: any :keyword protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON + :paramtype protected_settings: any :keyword instance_view: The virtual machine extension instance view. :paramtype instance_view: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionInstanceView @@ -15725,9 +16100,9 @@ def __init__( :paramtype provision_after_extensions: list[str] """ super().__init__(**kwargs) - self.name = None - self.type = None self.location = location + self.type: Optional[str] = None + self.vm_name: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -15736,7 +16111,7 @@ def __init__( self.enable_automatic_upgrade = enable_automatic_upgrade self.settings = settings self.protected_settings = protected_settings - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.instance_view = instance_view self.suppress_failures = suppress_failures self.protected_settings_from_key_vault = protected_settings_from_key_vault @@ -15791,8 +16166,8 @@ class VirtualMachineScaleSetVMExtensionsSummary(_serialization.Model): # pylint def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.statuses_summary = None + self.name: Optional[str] = None + self.statuses_summary: Optional[List["_models.VirtualMachineStatusCodeCount"]] = None class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): @@ -15824,10 +16199,10 @@ class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): upgraded by the platform if there is a newer version of the extension available. :vartype enable_automatic_upgrade: bool :ivar settings: Json formatted public settings for the extension. - :vartype settings: JSON + :vartype settings: any :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON + :vartype protected_settings: any :ivar suppress_failures: Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. @@ -15872,8 +16247,8 @@ def __init__( type_handler_version: Optional[str] = None, auto_upgrade_minor_version: Optional[bool] = None, enable_automatic_upgrade: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, suppress_failures: Optional[bool] = None, protected_settings_from_key_vault: Optional["_models.KeyVaultSecretReference"] = None, **kwargs: Any @@ -15897,10 +16272,10 @@ def __init__( upgraded by the platform if there is a newer version of the extension available. :paramtype enable_automatic_upgrade: bool :keyword settings: Json formatted public settings for the extension. - :paramtype settings: JSON + :paramtype settings: any :keyword protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON + :paramtype protected_settings: any :keyword suppress_failures: Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. @@ -15911,8 +16286,8 @@ def __init__( ~azure.mgmt.compute.v2024_11_01.models.KeyVaultSecretReference """ super().__init__(**kwargs) - self.name = None - self.type = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.force_update_tag = force_update_tag self.publisher = publisher self.type_properties_type = type_properties_type @@ -15996,8 +16371,7 @@ class VirtualMachineScaleSetVMInstanceView(_serialization.Model): :ivar extensions: The extensions information. :vartype extensions: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionInstanceView] - :ivar vm_health: The application health status for the VM, provided through Application Health - Extension or Load Balancer Health Probes. + :ivar vm_health: The health status for the VM. :vartype vm_health: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineHealthStatus :ivar boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. You can easily view the output of your @@ -16017,7 +16391,7 @@ class VirtualMachineScaleSetVMInstanceView(_serialization.Model): **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :vartype computer_name: str :ivar os_name: The Operating System running on the hybrid machine. :vartype os_name: str @@ -16102,7 +16476,7 @@ def __init__( **Max-length (Windows):** 15 characters :code:`
    `\\ :code:`
    ` **Max-length (Linux):** 64 characters. :code:`
    `\\ :code:`
    ` For naming conventions and restrictions see `Azure infrastructure services implementation guidelines - `_. # pylint: disable=line-too-long + `_. :paramtype computer_name: str :keyword os_name: The Operating System running on the hybrid machine. :paramtype os_name: str @@ -16120,10 +16494,10 @@ def __init__( self.maintenance_redeploy_status = maintenance_redeploy_status self.disks = disks self.extensions = extensions - self.vm_health = None + self.vm_health: Optional["_models.VirtualMachineHealthStatus"] = None self.boot_diagnostics = boot_diagnostics self.statuses = statuses - self.assigned_host = None + self.assigned_host: Optional[str] = None self.placement_group_id = placement_group_id self.computer_name = computer_name self.os_name = os_name @@ -16417,7 +16791,7 @@ def __init__( self.hardware_profile = hardware_profile self.service_artifact_reference = service_artifact_reference self.security_posture_reference = security_posture_reference - self.time_created = None + self.time_created: Optional[datetime.datetime] = None class VirtualMachineScaleSetVMProtectionPolicy(_serialization.Model): @@ -16535,19 +16909,31 @@ class VirtualMachineSizeListResult(_serialization.Model): :ivar value: The list of virtual machine sizes. :vartype value: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] + :ivar next_link: The link to the next page of items. + :vartype next_link: str """ _attribute_map = { "value": {"key": "value", "type": "[VirtualMachineSize]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.VirtualMachineSize"]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + value: Optional[List["_models.VirtualMachineSize"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: The list of virtual machine sizes. :paramtype value: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value + self.next_link = next_link class VirtualMachineSoftwarePatchProperties(_serialization.Model): @@ -16610,16 +16996,16 @@ class VirtualMachineSoftwarePatchProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.patch_id = None - self.name = None - self.version = None - self.kb_id = None - self.classifications = None - self.reboot_behavior = None - self.activity_id = None - self.published_date = None - self.last_modified_date_time = None - self.assessment_state = None + self.patch_id: Optional[str] = None + self.name: Optional[str] = None + self.version: Optional[str] = None + self.kb_id: Optional[str] = None + self.classifications: Optional[List[str]] = None + self.reboot_behavior: Optional[Union[str, "_models.VMGuestPatchRebootBehavior"]] = None + self.activity_id: Optional[str] = None + self.published_date: Optional[datetime.datetime] = None + self.last_modified_date_time: Optional[datetime.datetime] = None + self.assessment_state: Optional[Union[str, "_models.PatchAssessmentState"]] = None class VirtualMachineStatusCodeCount(_serialization.Model): @@ -16646,8 +17032,8 @@ class VirtualMachineStatusCodeCount(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.count = None + self.code: Optional[str] = None + self.count: Optional[int] = None class VirtualMachineUpdate(UpdateResource): @@ -16990,17 +17376,17 @@ def __init__( # pylint: disable=too-many-locals self.billing_profile = billing_profile self.host = host self.host_group = host_group - self.provisioning_state = None - self.instance_view = None + self.provisioning_state: Optional[str] = None + self.instance_view: Optional["_models.VirtualMachineInstanceView"] = None self.license_type = license_type - self.vm_id = None + self.vm_id: Optional[str] = None self.extensions_time_budget = extensions_time_budget self.platform_fault_domain = platform_fault_domain self.scheduled_events_profile = scheduled_events_profile self.user_data = user_data self.capacity_reservation = capacity_reservation self.application_profile = application_profile - self.time_created = None + self.time_created: Optional[datetime.datetime] = None class VMDiskSecurityProfile(_serialization.Model): @@ -17064,7 +17450,7 @@ class VMGalleryApplication(_serialization.Model): :ivar order: Optional, Specifies the order in which the packages have to be installed. :vartype order: int :ivar package_reference_id: Specifies the GalleryApplicationVersion resource id on the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. Required. :vartype package_reference_id: str :ivar configuration_reference: Optional, Specifies the uri to an azure blob that will replace @@ -17109,7 +17495,7 @@ def __init__( :paramtype order: int :keyword package_reference_id: Specifies the GalleryApplicationVersion resource id on the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. # pylint: disable=line-too-long + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. Required. :paramtype package_reference_id: str :keyword configuration_reference: Optional, Specifies the uri to an azure blob that will @@ -17327,7 +17713,7 @@ def __init__( self.additional_unattend_content = additional_unattend_content self.patch_settings = patch_settings self.win_rm = win_rm - self.enable_vm_agent_platform_updates = None + self.enable_vm_agent_platform_updates: Optional[bool] = None class WindowsParameters(_serialization.Model): diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/operations/__init__.py index 5cc9a11e2341..6718c8ecb4f9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/operations/__init__.py @@ -13,31 +13,31 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import Operations # type: ignore +from ._operations import AvailabilitySetsOperations # type: ignore +from ._operations import CapacityReservationGroupsOperations # type: ignore +from ._operations import DedicatedHostGroupsOperations # type: ignore +from ._operations import ImagesOperations # type: ignore +from ._operations import VirtualMachineImagesEdgeZoneOperations # type: ignore +from ._operations import VirtualMachineImagesOperations # type: ignore +from ._operations import LogAnalyticsOperations # type: ignore +from ._operations import VirtualMachineExtensionImagesOperations # type: ignore +from ._operations import VirtualMachineRunCommandsOperations # type: ignore from ._operations import UsageOperations # type: ignore -from ._operations import VirtualMachineSizesOperations # type: ignore from ._operations import VirtualMachineScaleSetsOperations # type: ignore -from ._operations import VirtualMachineScaleSetExtensionsOperations # type: ignore -from ._operations import VirtualMachineScaleSetRollingUpgradesOperations # type: ignore -from ._operations import VirtualMachineScaleSetVMExtensionsOperations # type: ignore -from ._operations import VirtualMachineScaleSetVMsOperations # type: ignore -from ._operations import VirtualMachineExtensionsOperations # type: ignore from ._operations import VirtualMachinesOperations # type: ignore -from ._operations import VirtualMachineImagesOperations # type: ignore -from ._operations import VirtualMachineImagesEdgeZoneOperations # type: ignore -from ._operations import VirtualMachineExtensionImagesOperations # type: ignore -from ._operations import AvailabilitySetsOperations # type: ignore +from ._operations import VirtualMachineSizesOperations # type: ignore from ._operations import ProximityPlacementGroupsOperations # type: ignore -from ._operations import DedicatedHostGroupsOperations # type: ignore -from ._operations import DedicatedHostsOperations # type: ignore -from ._operations import SshPublicKeysOperations # type: ignore -from ._operations import ImagesOperations # type: ignore from ._operations import RestorePointCollectionsOperations # type: ignore -from ._operations import RestorePointsOperations # type: ignore -from ._operations import CapacityReservationGroupsOperations # type: ignore +from ._operations import SshPublicKeysOperations # type: ignore from ._operations import CapacityReservationsOperations # type: ignore -from ._operations import LogAnalyticsOperations # type: ignore -from ._operations import VirtualMachineRunCommandsOperations # type: ignore +from ._operations import DedicatedHostsOperations # type: ignore +from ._operations import RestorePointsOperations # type: ignore +from ._operations import VirtualMachineScaleSetRollingUpgradesOperations # type: ignore +from ._operations import VirtualMachineScaleSetExtensionsOperations # type: ignore +from ._operations import VirtualMachineScaleSetVMsOperations # type: ignore +from ._operations import VirtualMachineScaleSetVMExtensionsOperations # type: ignore from ._operations import VirtualMachineScaleSetVMRunCommandsOperations # type: ignore +from ._operations import VirtualMachineExtensionsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -45,31 +45,31 @@ __all__ = [ "Operations", + "AvailabilitySetsOperations", + "CapacityReservationGroupsOperations", + "DedicatedHostGroupsOperations", + "ImagesOperations", + "VirtualMachineImagesEdgeZoneOperations", + "VirtualMachineImagesOperations", + "LogAnalyticsOperations", + "VirtualMachineExtensionImagesOperations", + "VirtualMachineRunCommandsOperations", "UsageOperations", - "VirtualMachineSizesOperations", "VirtualMachineScaleSetsOperations", - "VirtualMachineScaleSetExtensionsOperations", - "VirtualMachineScaleSetRollingUpgradesOperations", - "VirtualMachineScaleSetVMExtensionsOperations", - "VirtualMachineScaleSetVMsOperations", - "VirtualMachineExtensionsOperations", "VirtualMachinesOperations", - "VirtualMachineImagesOperations", - "VirtualMachineImagesEdgeZoneOperations", - "VirtualMachineExtensionImagesOperations", - "AvailabilitySetsOperations", + "VirtualMachineSizesOperations", "ProximityPlacementGroupsOperations", - "DedicatedHostGroupsOperations", - "DedicatedHostsOperations", - "SshPublicKeysOperations", - "ImagesOperations", "RestorePointCollectionsOperations", - "RestorePointsOperations", - "CapacityReservationGroupsOperations", + "SshPublicKeysOperations", "CapacityReservationsOperations", - "LogAnalyticsOperations", - "VirtualMachineRunCommandsOperations", + "DedicatedHostsOperations", + "RestorePointsOperations", + "VirtualMachineScaleSetRollingUpgradesOperations", + "VirtualMachineScaleSetExtensionsOperations", + "VirtualMachineScaleSetVMsOperations", + "VirtualMachineScaleSetVMExtensionsOperations", "VirtualMachineScaleSetVMRunCommandsOperations", + "VirtualMachineExtensionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/operations/_operations.py index de3d9e4964eb..d7f5e89cc594 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +61,9 @@ def build_operations_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_usage_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_availability_sets_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -71,18 +71,17 @@ def build_usage_list_request(location: str, subscription_id: str, **kwargs: Any) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets") path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -90,7 +89,7 @@ def build_usage_list_request(location: str, subscription_id: str, **kwargs: Any) return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_sizes_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_availability_sets_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -99,11 +98,14 @@ def build_virtual_machine_sizes_list_request(location: str, subscription_id: str # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" - ) # pylint: disable=line-too-long + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -117,8 +119,8 @@ def build_virtual_machine_sizes_list_request(location: str, subscription_id: str return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_list_by_location_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_availability_sets_get_request( + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -129,11 +131,14 @@ def build_virtual_machine_scale_sets_list_by_location_request( # pylint: disabl # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -147,14 +152,8 @@ def build_virtual_machine_scale_sets_list_by_location_request( # pylint: disabl return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any +def build_availability_sets_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -166,12 +165,14 @@ def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disabl # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -180,10 +181,6 @@ def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disabl _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -191,14 +188,8 @@ def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disabl return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_update_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any +def build_availability_sets_update_request( + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -210,12 +201,14 @@ def build_virtual_machine_scale_sets_update_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -224,10 +217,6 @@ def build_virtual_machine_scale_sets_update_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -235,13 +224,8 @@ def build_virtual_machine_scale_sets_update_request( # pylint: disable=name-too return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_delete_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - force_deletion: Optional[bool] = None, - **kwargs: Any +def build_availability_sets_delete_request( + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -252,19 +236,19 @@ def build_virtual_machine_scale_sets_delete_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if force_deletion is not None: - _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -273,13 +257,8 @@ def build_virtual_machine_scale_sets_delete_request( # pylint: disable=name-too return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_get_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetVMScaleSets]] = None, - **kwargs: Any +def build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -290,34 +269,29 @@ def build_virtual_machine_scale_sets_get_request( # pylint: disable=name-too-lo # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/cancelMigrationToVirtualMachineScaleSet", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_deallocate_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - hibernate: Optional[bool] = None, - **kwargs: Any +def build_availability_sets_convert_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -329,19 +303,19 @@ def build_virtual_machine_scale_sets_deallocate_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/convertToVirtualMachineScaleSet", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if hibernate is not None: - _params["hibernate"] = _SERIALIZER.query("hibernate", hibernate, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -352,13 +326,8 @@ def build_virtual_machine_scale_sets_deallocate_request( # pylint: disable=name return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_delete_instances_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - force_deletion: Optional[bool] = None, - **kwargs: Any +def build_availability_sets_start_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -370,19 +339,19 @@ def build_virtual_machine_scale_sets_delete_instances_request( # pylint: disabl # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/startMigrationToVirtualMachineScaleSet", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if force_deletion is not None: - _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -393,24 +362,27 @@ def build_virtual_machine_scale_sets_delete_instances_request( # pylint: disabl return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_get_instance_view_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/validateMigrationToVirtualMachineScaleSet", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -419,13 +391,15 @@ def build_virtual_machine_scale_sets_get_instance_view_request( # pylint: disab _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_list_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_availability_sets_list_available_sizes_request( # pylint: disable=name-too-long + resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -436,11 +410,14 @@ def build_virtual_machine_scale_sets_list_request( # pylint: disable=name-too-l # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -454,8 +431,12 @@ def build_virtual_machine_scale_sets_list_request( # pylint: disable=name-too-l return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_list_all_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any +def build_capacity_reservation_groups_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -465,16 +446,20 @@ def build_virtual_machine_scale_sets_list_all_request( # pylint: disable=name-t # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets" + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups" ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if resource_ids_only is not None: + _params["resourceIdsOnly"] = _SERIALIZER.query("resource_ids_only", resource_ids_only, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -482,8 +467,12 @@ def build_virtual_machine_scale_sets_list_all_request( # pylint: disable=name-t return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_list_skus_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservation_groups_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -494,18 +483,21 @@ def build_virtual_machine_scale_sets_list_skus_request( # pylint: disable=name- # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -513,8 +505,13 @@ def build_virtual_machine_scale_sets_list_skus_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_get_os_upgrade_history_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservation_groups_get_request( # pylint: disable=name-too-long + resource_group_name: str, + capacity_reservation_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.CapacityReservationGroupInstanceViewTypes]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -525,18 +522,24 @@ def build_virtual_machine_scale_sets_get_os_upgrade_history_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -544,13 +547,8 @@ def build_virtual_machine_scale_sets_get_os_upgrade_history_request( # pylint: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_power_off_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - skip_shutdown: bool = False, - **kwargs: Any +def build_capacity_reservation_groups_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -562,19 +560,21 @@ def build_virtual_machine_scale_sets_power_off_request( # pylint: disable=name- # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if skip_shutdown is not None: - _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -582,11 +582,11 @@ def build_virtual_machine_scale_sets_power_off_request( # pylint: disable=name- _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_restart_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservation_groups_update_request( # pylint: disable=name-too-long + resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -598,12 +598,16 @@ def build_virtual_machine_scale_sets_restart_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -616,28 +620,31 @@ def build_virtual_machine_scale_sets_restart_request( # pylint: disable=name-to _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_start_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservation_groups_delete_request( # pylint: disable=name-too-long + resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -646,15 +653,13 @@ def build_virtual_machine_scale_sets_start_request( # pylint: disable=name-too- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_reapply_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_host_groups_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -663,14 +668,9 @@ def build_virtual_machine_scale_sets_reapply_request( # pylint: disable=name-to accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reapply", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups") path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -681,28 +681,28 @@ def build_virtual_machine_scale_sets_reapply_request( # pylint: disable=name-to # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_redeploy_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -711,49 +711,53 @@ def build_virtual_machine_scale_sets_redeploy_request( # pylint: disable=name-t _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_perform_maintenance_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_host_groups_get_request( + resource_group_name: str, + host_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_update_instances_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_host_groups_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -765,12 +769,14 @@ def build_virtual_machine_scale_sets_update_instances_request( # pylint: disabl # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -783,11 +789,11 @@ def build_virtual_machine_scale_sets_update_instances_request( # pylint: disabl _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_reimage_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_host_groups_update_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -799,12 +805,14 @@ def build_virtual_machine_scale_sets_reimage_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -817,28 +825,29 @@ def build_virtual_machine_scale_sets_reimage_request( # pylint: disable=name-to _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_reimage_all_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_host_groups_delete_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -847,32 +856,22 @@ def build_virtual_machine_scale_sets_reimage_all_request( # pylint: disable=nam _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_approve_rolling_upgrade_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_images_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/approveRollingUpgrade", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images") path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -881,22 +880,13 @@ def build_virtual_machine_scale_sets_approve_rolling_upgrade_request( # pylint: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - subscription_id: str, - *, - platform_update_domain: int, - zone: Optional[str] = None, - placement_group_id: Optional[str] = None, - **kwargs: Any +def build_images_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -907,66 +897,63 @@ def build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_upda # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _params["platformUpdateDomain"] = _SERIALIZER.query("platform_update_domain", platform_update_domain, "int") - if zone is not None: - _params["zone"] = _SERIALIZER.query("zone", zone, "str") - if placement_group_id is not None: - _params["placementGroupId"] = _SERIALIZER.query("placement_group_id", placement_group_id, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_convert_to_single_placement_group_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_images_get_request( + resource_group_name: str, image_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_sets_set_orchestration_service_state_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_images_create_or_update_request( + resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -978,12 +965,14 @@ def build_virtual_machine_scale_sets_set_orchestration_service_state_request( # # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -996,11 +985,11 @@ def build_virtual_machine_scale_sets_set_orchestration_service_state_request( # _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_extensions_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, subscription_id: str, **kwargs: Any +def build_images_update_request( + resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1012,13 +1001,14 @@ def build_virtual_machine_scale_set_extensions_create_or_update_request( # pyli # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1031,29 +1021,29 @@ def build_virtual_machine_scale_set_extensions_create_or_update_request( # pyli _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_extensions_update_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, subscription_id: str, **kwargs: Any +def build_images_delete_request( + resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "imageName": _SERIALIZER.url("image_name", image_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1062,15 +1052,13 @@ def build_virtual_machine_scale_set_extensions_update_request( # pylint: disabl _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_extensions_delete_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_images_edge_zone_list_publishers_request( # pylint: disable=name-too-long + location: str, edge_zone: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1081,13 +1069,12 @@ def build_virtual_machine_scale_set_extensions_delete_request( # pylint: disabl # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1098,17 +1085,11 @@ def build_virtual_machine_scale_set_extensions_delete_request( # pylint: disabl # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_extensions_get_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - subscription_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any +def build_virtual_machine_images_edge_zone_list_offers_request( # pylint: disable=name-too-long + location: str, edge_zone: str, publisher_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1119,20 +1100,18 @@ def build_virtual_machine_scale_set_extensions_get_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -1141,8 +1120,8 @@ def build_virtual_machine_scale_set_extensions_get_request( # pylint: disable=n return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_extensions_list_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_images_edge_zone_list_skus_request( # pylint: disable=name-too-long + location: str, edge_zone: str, publisher_name: str, offer: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1153,12 +1132,14 @@ def build_virtual_machine_scale_set_extensions_list_request( # pylint: disable= # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1172,8 +1153,18 @@ def build_virtual_machine_scale_set_extensions_list_request( # pylint: disable= return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_rolling_upgrades_cancel_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_images_edge_zone_list_request( # pylint: disable=name-too-long + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1184,27 +1175,43 @@ def build_virtual_machine_scale_set_rolling_upgrades_cancel_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), + "skus": _SERIALIZER.url("skus", skus, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_images_edge_zone_get_request( # pylint: disable=name-too-long + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1215,12 +1222,16 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), + "skus": _SERIALIZER.url("skus", skus, "str"), + "version": _SERIALIZER.url("version", version, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1231,11 +1242,11 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_images_list_by_edge_zone_request( # pylint: disable=name-too-long + location: str, edge_zone: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1246,12 +1257,12 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_req # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/vmimages", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1262,11 +1273,11 @@ def build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_req # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_images_list_publishers_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 {}) @@ -1276,13 +1287,11 @@ def build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( # pyli # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", - ) # pylint: disable=line-too-long + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1296,32 +1305,24 @@ def build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( # pyli return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_extensions_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machine_images_list_offers_request( # pylint: disable=name-too-long + location: str, publisher_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1330,39 +1331,30 @@ def build_virtual_machine_scale_set_vm_extensions_create_or_update_request( # p _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_extensions_update_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machine_images_list_skus_request( # pylint: disable=name-too-long + location: str, publisher_name: str, offer: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1371,19 +1363,21 @@ def build_virtual_machine_scale_set_vm_extensions_update_request( # pylint: dis _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_extensions_delete_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, +def build_virtual_machine_images_list_request( # pylint: disable=name-too-long + location: str, + publisher_name: str, + offer: str, + skus: str, subscription_id: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1395,36 +1389,35 @@ def build_virtual_machine_scale_set_vm_extensions_delete_request( # pylint: dis # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), + "skus": _SERIALIZER.url("skus", skus, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - subscription_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any +def build_virtual_machine_images_get_request( + location: str, publisher_name: str, offer: str, skus: str, version: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1435,21 +1428,20 @@ def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disabl # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), + "skus": _SERIALIZER.url("skus", skus, "str"), + "version": _SERIALIZER.url("version", version, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -1458,13 +1450,16 @@ def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disabl return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_extensions_list_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, +def build_virtual_machine_images_list_with_properties_request( # pylint: disable=name-too-long + location: str, + publisher_name: str, + offer: str, + skus: str, subscription_id: str, *, - expand: Optional[str] = None, + expand: Union[str, _models.Expand], + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1476,21 +1471,25 @@ def build_virtual_machine_scale_set_vm_extensions_list_request( # pylint: disab # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "offer": _SERIALIZER.url("offer", offer, "str"), + "skus": _SERIALIZER.url("skus", skus, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1498,8 +1497,8 @@ def build_virtual_machine_scale_set_vm_extensions_list_request( # pylint: disab return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_log_analytics_export_request_rate_by_interval_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 {}) @@ -1511,13 +1510,11 @@ def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1533,25 +1530,24 @@ def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_reimage_all_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_log_analytics_export_throttled_requests_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1560,13 +1556,15 @@ def build_virtual_machine_scale_set_vms_reimage_all_request( # pylint: disable= _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_extension_images_list_types_request( # pylint: disable=name-too-long + location: str, publisher_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1577,13 +1575,12 @@ def build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( # pyli # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/approveRollingUpgrade", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1594,11 +1591,19 @@ def build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( # pyli # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_extension_images_list_versions_request( # pylint: disable=name-too-long + location: str, + publisher_name: str, + type: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1609,53 +1614,52 @@ def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "type": _SERIALIZER.url("type", type, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if orderby is not None: + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any +def build_virtual_machine_extension_images_get_request( # pylint: disable=name-too-long + location: str, publisher_name: str, type: str, version: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), + "type": _SERIALIZER.url("type", type, "str"), + "version": _SERIALIZER.url("version", version, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1664,89 +1668,63 @@ def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_delete_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - subscription_id: str, - *, - force_deletion: Optional[bool] = None, - **kwargs: Any +def build_virtual_machine_run_commands_list_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - accept = _headers.pop("Accept", "application/json") + accept = _headers.pop("Accept", "application/json, text/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}", - ) # pylint: disable=line-too-long + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if force_deletion is not None: - _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any +def build_virtual_machine_run_commands_get_request( # pylint: disable=name-too-long + location: str, command_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - accept = _headers.pop("Accept", "application/json") + accept = _headers.pop("Accept", "application/json, text/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str", min_length=1), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -1755,8 +1733,8 @@ def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_run_commands_list_by_virtual_machine_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1767,19 +1745,22 @@ def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: di # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/instanceView", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1787,13 +1768,12 @@ def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: di return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-too-long +def build_virtual_machine_run_commands_get_by_virtual_machine_request( # pylint: disable=name-too-long resource_group_name: str, - virtual_machine_scale_set_name: str, + vm_name: str, + run_command_name: str, subscription_id: str, *, - filter: Optional[str] = None, - select: Optional[str] = None, expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: @@ -1806,26 +1786,23 @@ def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineScaleSetName": _SERIALIZER.url( - "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if select is not None: - _params["$select"] = _SERIALIZER.query("select", select, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if expand is not None: _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1833,65 +1810,65 @@ def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-to return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_power_off_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - subscription_id: str, - *, - skip_shutdown: bool = False, - **kwargs: Any +def build_virtual_machine_run_commands_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if skip_shutdown is not None: - _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_run_commands_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1900,13 +1877,15 @@ def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_run_commands_delete_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1917,13 +1896,15 @@ def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-t # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1934,12 +1915,10 @@ def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-t # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_usage_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1948,14 +1927,11 @@ def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=nam # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy", - ) # pylint: disable=line-too-long + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1966,17 +1942,11 @@ def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=nam # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - subscription_id: str, - *, - sas_uri_expiration_time_in_minutes: Optional[int] = None, - **kwargs: Any +def build_virtual_machine_scale_sets_list_by_location_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 {}) @@ -1987,32 +1957,26 @@ def build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if sas_uri_expiration_time_in_minutes is not None: - _params["sasUriExpirationTimeInMinutes"] = _SERIALIZER.query( - "sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, "int" - ) _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_list_all_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2022,14 +1986,10 @@ def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance", - ) # pylint: disable=line-too-long + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets" + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2040,11 +2000,11 @@ def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_simulate_eviction_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_list_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2055,13 +2015,13 @@ def build_virtual_machine_scale_set_vms_simulate_eviction_request( # pylint: di # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2072,64 +2032,76 @@ def build_virtual_machine_scale_set_vms_simulate_eviction_request( # pylint: di # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_get_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetVMScaleSets]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/attachDetachDataDisks", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vms_run_command_request( # pylint: disable=name-too-long - resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json, text/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2138,15 +2110,25 @@ def build_virtual_machine_scale_set_vms_run_command_request( # pylint: disable= _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extensions_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2158,13 +2140,14 @@ def build_virtual_machine_extensions_create_or_update_request( # pylint: disabl # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2173,67 +2156,78 @@ def build_virtual_machine_extensions_create_or_update_request( # pylint: disabl _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extensions_update_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_deletion is not None: + _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_approve_rolling_upgrade_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/approveRollingUpgrade", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2242,173 +2236,200 @@ def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - subscription_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any +def build_virtual_machine_scale_sets_convert_to_single_placement_group_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extensions_list_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +def build_virtual_machine_scale_sets_deallocate_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + hibernate: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if hibernate is not None: + _params["hibernate"] = _SERIALIZER.query("hibernate", hibernate, "bool") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_list_by_location_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_delete_instances_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_deletion is not None: + _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_capture_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + zone: Optional[str] = None, + placement_group_id: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["platformUpdateDomain"] = _SERIALIZER.query("platform_update_domain", platform_update_domain, "int") + if zone is not None: + _params["zone"] = _SERIALIZER.query("zone", zone, "str") + if placement_group_id is not None: + _params["placementGroupId"] = _SERIALIZER.query("placement_group_id", placement_group_id, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any +def build_virtual_machine_scale_sets_get_instance_view_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2417,25 +2438,13 @@ def build_virtual_machines_create_or_update_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_update_request( - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any +def build_virtual_machine_scale_sets_update_instances_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2447,12 +2456,14 @@ def build_virtual_machines_update_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2461,24 +2472,15 @@ def build_virtual_machines_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_delete_request( - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - force_deletion: Optional[bool] = None, - **kwargs: Any +def build_virtual_machine_scale_sets_get_os_upgrade_history_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2489,98 +2491,108 @@ def build_virtual_machines_delete_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if force_deletion is not None: - _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_get_request( - resource_group_name: str, - vm_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any +def build_virtual_machine_scale_sets_perform_maintenance_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_instance_view_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_power_off_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_shutdown is not None: + _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_reapply_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2591,12 +2603,14 @@ def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable= # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reapply", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2610,57 +2624,63 @@ def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable= return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_deallocate_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, *, hibernate: Optional[bool] = None, **kwargs: Any +def build_virtual_machine_scale_sets_redeploy_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if hibernate is not None: - _params["hibernate"] = _SERIALIZER.query("hibernate", hibernate, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_generalize_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_reimage_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2669,105 +2689,106 @@ def build_virtual_machines_generalize_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_list_request( - resource_group_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, - **kwargs: Any +def build_virtual_machine_scale_sets_reimage_all_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_list_all_request( - subscription_id: str, - *, - status_only: Optional[str] = None, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, - **kwargs: Any +def build_virtual_machine_scale_sets_restart_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if status_only is not None: - _params["statusOnly"] = _SERIALIZER.query("status_only", status_only, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_list_available_sizes_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_set_orchestration_service_state_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2776,13 +2797,15 @@ def build_virtual_machines_list_available_sizes_request( # pylint: disable=name _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_power_off_request( - resource_group_name: str, vm_name: str, subscription_id: str, *, skip_shutdown: bool = False, **kwargs: Any +def build_virtual_machine_scale_sets_list_skus_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2793,45 +2816,48 @@ def build_virtual_machines_power_off_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if skip_shutdown is not None: - _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_reapply_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_sets_start_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2840,13 +2866,15 @@ def build_virtual_machines_reapply_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_restart_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_list_by_location_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 {}) @@ -2857,12 +2885,11 @@ def build_virtual_machines_restart_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2873,11 +2900,16 @@ def build_virtual_machines_restart_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_start_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_list_all_request( + subscription_id: str, + *, + status_only: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2886,29 +2918,35 @@ def build_virtual_machines_start_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines") path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if status_only is not None: + _params["statusOnly"] = _SERIALIZER.query("status_only", status_only, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_redeploy_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_list_request( + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2919,117 +2957,143 @@ def build_virtual_machines_redeploy_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_reimage_request( - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_retrieve_boot_diagnostics_data_request( # pylint: disable=name-too-long +def build_virtual_machines_create_or_update_request( # pylint: disable=name-too-long resource_group_name: str, vm_name: str, subscription_id: str, *, - sas_uri_expiration_time_in_minutes: Optional[int] = None, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if sas_uri_expiration_time_in_minutes is not None: - _params["sasUriExpirationTimeInMinutes"] = _SERIALIZER.query( - "sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, "int" - ) _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_perform_maintenance_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_update_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3038,13 +3102,24 @@ def build_virtual_machines_perform_maintenance_request( # pylint: disable=name- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_simulate_eviction_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_delete_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3055,23 +3130,27 @@ def build_virtual_machines_simulate_eviction_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_deletion is not None: + _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_virtual_machines_assess_patches_request( # pylint: disable=name-too-long @@ -3087,11 +3166,13 @@ def build_virtual_machines_assess_patches_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3105,7 +3186,7 @@ def build_virtual_machines_assess_patches_request( # pylint: disable=name-too-l return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_install_patches_request( # pylint: disable=name-too-long +def build_virtual_machines_attach_detach_data_disks_request( # pylint: disable=name-too-long resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3118,12 +3199,14 @@ def build_virtual_machines_install_patches_request( # pylint: disable=name-too- # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/attachDetachDataDisks", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3139,7 +3222,7 @@ def build_virtual_machines_install_patches_request( # pylint: disable=name-too- return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_attach_detach_data_disks_request( # pylint: disable=name-too-long +def build_virtual_machines_capture_request( resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3152,12 +3235,14 @@ def build_virtual_machines_attach_detach_data_disks_request( # pylint: disable= # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/attachDetachDataDisks", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3173,25 +3258,26 @@ def build_virtual_machines_attach_detach_data_disks_request( # pylint: disable= return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_migrate_to_vm_scale_set_request( # pylint: disable=name-too-long +def build_virtual_machines_convert_to_managed_disks_request( # pylint: disable=name-too-long resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/migrateToVirtualMachineScaleSet", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3200,49 +3286,48 @@ def build_virtual_machines_migrate_to_vm_scale_set_request( # pylint: disable=n _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machines_run_command_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_deallocate_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, *, hibernate: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json, text/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if hibernate is not None: + _params["hibernate"] = _SERIALIZER.query("hibernate", hibernate, "bool") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_get_request( - location: str, publisher_name: str, offer: str, skus: str, version: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_generalize_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3253,15 +3338,14 @@ def build_virtual_machine_images_get_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "offer": _SERIALIZER.url("offer", offer, "str"), - "skus": _SERIALIZER.url("skus", skus, "str"), - "version": _SERIALIZER.url("version", version, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3272,59 +3356,47 @@ def build_virtual_machine_images_get_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_list_request( # pylint: disable=name-too-long - location: str, - publisher_name: str, - offer: str, - skus: str, - subscription_id: str, - *, - expand: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any +def build_virtual_machines_install_patches_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "offer": _SERIALIZER.url("offer", offer, "str"), - "skus": _SERIALIZER.url("skus", skus, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_list_offers_request( # pylint: disable=name-too-long - location: str, publisher_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_instance_view_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3335,12 +3407,14 @@ def build_virtual_machine_images_list_offers_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3354,22 +3428,27 @@ def build_virtual_machine_images_list_offers_request( # pylint: disable=name-to return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_list_publishers_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_migrate_to_vm_scale_set_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" - ) # pylint: disable=line-too-long + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/migrateToVirtualMachineScaleSet", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3378,13 +3457,15 @@ def build_virtual_machine_images_list_publishers_request( # pylint: disable=nam _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_list_skus_request( # pylint: disable=name-too-long - location: str, publisher_name: str, offer: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_perform_maintenance_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3395,13 +3476,14 @@ def build_virtual_machine_images_list_skus_request( # pylint: disable=name-too- # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "offer": _SERIALIZER.url("offer", offer, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3412,11 +3494,11 @@ def build_virtual_machine_images_list_skus_request( # pylint: disable=name-too- # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_list_by_edge_zone_request( # pylint: disable=name-too-long - location: str, edge_zone: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_power_off_request( + resource_group_name: str, vm_name: str, subscription_id: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3427,36 +3509,31 @@ def build_virtual_machine_images_list_by_edge_zone_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/vmimages", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_shutdown is not None: + _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_list_with_properties_request( # pylint: disable=name-too-long - location: str, - publisher_name: str, - offer: str, - skus: str, - subscription_id: str, - *, - expand: Union[str, _models.Expand], - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any +def build_virtual_machines_reapply_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3467,41 +3544,29 @@ def build_virtual_machine_images_list_with_properties_request( # pylint: disabl # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "offer": _SERIALIZER.url("offer", offer, "str"), - "skus": _SERIALIZER.url("skus", skus, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_edge_zone_get_request( # pylint: disable=name-too-long - location: str, - edge_zone: str, - publisher_name: str, - offer: str, - skus: str, - version: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machines_redeploy_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3512,16 +3577,14 @@ def build_virtual_machine_images_edge_zone_get_request( # pylint: disable=name- # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "offer": _SERIALIZER.url("offer", offer, "str"), - "skus": _SERIALIZER.url("skus", skus, "str"), - "version": _SERIALIZER.url("version", version, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3532,61 +3595,47 @@ def build_virtual_machine_images_edge_zone_get_request( # pylint: disable=name- # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_edge_zone_list_request( # pylint: disable=name-too-long - location: str, - edge_zone: str, - publisher_name: str, - offer: str, - skus: str, - subscription_id: str, - *, - expand: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any +def build_virtual_machines_reimage_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "offer": _SERIALIZER.url("offer", offer, "str"), - "skus": _SERIALIZER.url("skus", skus, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_edge_zone_list_offers_request( # pylint: disable=name-too-long - location: str, edge_zone: str, publisher_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_restart_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3597,13 +3646,14 @@ def build_virtual_machine_images_edge_zone_list_offers_request( # pylint: disab # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3614,11 +3664,16 @@ def build_virtual_machine_images_edge_zone_list_offers_request( # pylint: disab # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_edge_zone_list_publishers_request( # pylint: disable=name-too-long - location: str, edge_zone: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_retrieve_boot_diagnostics_data_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3629,45 +3684,52 @@ def build_virtual_machine_images_edge_zone_list_publishers_request( # pylint: d # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if sas_uri_expiration_time_in_minutes is not None: + _params["sasUriExpirationTimeInMinutes"] = _SERIALIZER.query( + "sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, "int" + ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_images_edge_zone_list_skus_request( # pylint: disable=name-too-long - location: str, edge_zone: str, publisher_name: str, offer: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_run_command_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "edgeZone": _SERIALIZER.url("edge_zone", edge_zone, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "offer": _SERIALIZER.url("offer", offer, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3676,13 +3738,15 @@ def build_virtual_machine_images_edge_zone_list_skus_request( # pylint: disable _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extension_images_get_request( # pylint: disable=name-too-long - location: str, publisher_name: str, type: str, version: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_simulate_eviction_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3693,14 +3757,14 @@ def build_virtual_machine_extension_images_get_request( # pylint: disable=name- # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "type": _SERIALIZER.url("type", type, "str"), - "version": _SERIALIZER.url("version", version, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3711,11 +3775,11 @@ def build_virtual_machine_extension_images_get_request( # pylint: disable=name- # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extension_images_list_types_request( # pylint: disable=name-too-long - location: str, publisher_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machines_start_request( + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3726,12 +3790,14 @@ def build_virtual_machine_extension_images_list_types_request( # pylint: disabl # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3742,19 +3808,11 @@ def build_virtual_machine_extension_images_list_types_request( # pylint: disabl # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_extension_images_list_versions_request( # pylint: disable=name-too-long - location: str, - publisher_name: str, - type: str, - subscription_id: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any +def build_virtual_machines_list_available_sizes_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3765,24 +3823,19 @@ def build_virtual_machine_extension_images_list_versions_request( # pylint: dis # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "publisherName": _SERIALIZER.url("publisher_name", publisher_name, "str"), - "type": _SERIALIZER.url("type", type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -3791,25 +3844,20 @@ def build_virtual_machine_extension_images_list_versions_request( # pylint: dis return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_virtual_machine_sizes_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "location": _SERIALIZER.url("location", location, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3818,32 +3866,26 @@ def build_availability_sets_create_or_update_request( # pylint: disable=name-to _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_update_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_proximity_placement_groups_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups" + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3852,15 +3894,13 @@ def build_availability_sets_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_delete_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_proximity_placement_groups_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3871,12 +3911,13 @@ def build_availability_sets_delete_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3887,11 +3928,16 @@ def build_availability_sets_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_get_request( - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_proximity_placement_groups_get_request( # pylint: disable=name-too-long + resource_group_name: str, + proximity_placement_group_name: str, + subscription_id: str, + *, + include_colocation_status: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3902,18 +3948,26 @@ def build_availability_sets_get_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "proximityPlacementGroupName": _SERIALIZER.url( + "proximity_placement_group_name", proximity_placement_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if include_colocation_status is not None: + _params["includeColocationStatus"] = _SERIALIZER.query( + "include_colocation_status", include_colocation_status, "str" + ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -3921,49 +3975,67 @@ def build_availability_sets_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +def build_proximity_placement_groups_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "proximityPlacementGroupName": _SERIALIZER.url( + "proximity_placement_group_name", proximity_placement_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_proximity_placement_groups_update_request( # pylint: disable=name-too-long + resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "proximityPlacementGroupName": _SERIALIZER.url( + "proximity_placement_group_name", proximity_placement_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3972,13 +4044,15 @@ def build_availability_sets_list_request(resource_group_name: str, subscription_ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_list_available_sizes_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_proximity_placement_groups_delete_request( # pylint: disable=name-too-long + resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -3989,12 +4063,16 @@ def build_availability_sets_list_available_sizes_request( # pylint: disable=nam # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "proximityPlacementGroupName": _SERIALIZER.url( + "proximity_placement_group_name", proximity_placement_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4005,28 +4083,24 @@ def build_availability_sets_list_available_sizes_request( # pylint: disable=nam # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_start_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_restore_point_collections_list_all_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/startMigrationToVirtualMachineScaleSet", - ) # pylint: disable=line-too-long + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections" + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4035,15 +4109,13 @@ def build_availability_sets_start_migration_to_virtual_machine_scale_set_request _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_restore_point_collections_list_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4054,12 +4126,13 @@ def build_availability_sets_cancel_migration_to_virtual_machine_scale_set_reques # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/cancelMigrationToVirtualMachineScaleSet", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4070,45 +4143,53 @@ def build_availability_sets_cancel_migration_to_virtual_machine_scale_set_reques # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_restore_point_collections_get_request( # pylint: disable=name-too-long + resource_group_name: str, + restore_point_collection_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/validateMigrationToVirtualMachineScaleSet", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_availability_sets_convert_to_virtual_machine_scale_set_request( # pylint: disable=name-too-long - resource_group_name: str, availability_set_name: str, subscription_id: str, **kwargs: Any +def build_restore_point_collections_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4120,12 +4201,16 @@ def build_availability_sets_convert_to_virtual_machine_scale_set_request( # pyl # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/convertToVirtualMachineScaleSet", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("availability_set_name", availability_set_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4138,11 +4223,11 @@ def build_availability_sets_convert_to_virtual_machine_scale_set_request( # pyl _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_proximity_placement_groups_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any +def build_restore_point_collections_update_request( # pylint: disable=name-too-long + resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4154,14 +4239,16 @@ def build_proximity_placement_groups_create_or_update_request( # pylint: disabl # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "proximityPlacementGroupName": _SERIALIZER.url( - "proximity_placement_group_name", proximity_placement_group_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4174,30 +4261,31 @@ def build_proximity_placement_groups_create_or_update_request( # pylint: disabl _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_proximity_placement_groups_update_request( # pylint: disable=name-too-long - resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any +def build_restore_point_collections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "proximityPlacementGroupName": _SERIALIZER.url( - "proximity_placement_group_name", proximity_placement_group_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4206,15 +4294,13 @@ def build_proximity_placement_groups_update_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_proximity_placement_groups_delete_request( # pylint: disable=name-too-long - resource_group_name: str, proximity_placement_group_name: str, subscription_id: str, **kwargs: Any +def build_ssh_public_keys_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4223,16 +4309,9 @@ def build_proximity_placement_groups_delete_request( # pylint: disable=name-too accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys") path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "proximityPlacementGroupName": _SERIALIZER.url( - "proximity_placement_group_name", proximity_placement_group_name, "str" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4243,16 +4322,11 @@ def build_proximity_placement_groups_delete_request( # pylint: disable=name-too # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_proximity_placement_groups_get_request( # pylint: disable=name-too-long - resource_group_name: str, - proximity_placement_group_name: str, - subscription_id: str, - *, - include_colocation_status: Optional[str] = None, - **kwargs: Any +def build_ssh_public_keys_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4263,23 +4337,18 @@ def build_proximity_placement_groups_get_request( # pylint: disable=name-too-lo # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "proximityPlacementGroupName": _SERIALIZER.url( - "proximity_placement_group_name", proximity_placement_group_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if include_colocation_status is not None: - _params["includeColocationStatus"] = _SERIALIZER.query( - "include_colocation_status", include_colocation_status, "str" - ) _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -4288,8 +4357,8 @@ def build_proximity_placement_groups_get_request( # pylint: disable=name-too-lo return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_proximity_placement_groups_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any +def build_ssh_public_keys_get_request( + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4299,10 +4368,15 @@ def build_proximity_placement_groups_list_by_subscription_request( # pylint: di # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups" + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4316,23 +4390,27 @@ def build_proximity_placement_groups_list_by_subscription_request( # pylint: di return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_proximity_placement_groups_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_ssh_public_keys_create_request( + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4341,13 +4419,15 @@ def build_proximity_placement_groups_list_by_resource_group_request( # pylint: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_host_groups_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any +def build_ssh_public_keys_update_request( + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4359,12 +4439,14 @@ def build_dedicated_host_groups_create_or_update_request( # pylint: disable=nam # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4377,28 +4459,29 @@ def build_dedicated_host_groups_create_or_update_request( # pylint: disable=nam _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_host_groups_update_request( # pylint: disable=name-too-long - resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any +def build_ssh_public_keys_delete_request( + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4407,31 +4490,32 @@ def build_dedicated_host_groups_update_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_host_groups_delete_request( # pylint: disable=name-too-long - resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any +def build_ssh_public_keys_generate_key_pair_request( # pylint: disable=name-too-long + resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4440,18 +4524,15 @@ def build_dedicated_host_groups_delete_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_host_groups_get_request( - resource_group_name: str, - host_group_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any +def build_capacity_reservations_list_by_capacity_reservation_group_request( # pylint: disable=name-too-long + resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4462,19 +4543,21 @@ def build_dedicated_host_groups_get_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -4483,8 +4566,14 @@ def build_dedicated_host_groups_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservations_get_request( + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.CapacityReservationInstanceViewTypes]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4495,17 +4584,25 @@ def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disab # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4513,19 +4610,34 @@ def build_dedicated_host_groups_list_by_resource_group_request( # pylint: disab return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_host_groups_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any +def build_capacity_reservations_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4534,13 +4646,19 @@ def build_dedicated_host_groups_list_by_subscription_request( # pylint: disable _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservations_update_request( # pylint: disable=name-too-long + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4552,13 +4670,17 @@ def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too- # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4571,29 +4693,36 @@ def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too- _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_hosts_update_request( - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +def build_capacity_reservations_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "capacityReservationGroupName": _SERIALIZER.url( + "capacity_reservation_group_name", capacity_reservation_group_name, "str" + ), + "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4602,15 +4731,13 @@ def build_dedicated_hosts_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_hosts_delete_request( - resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_hosts_list_by_host_group_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4621,13 +4748,14 @@ def build_dedicated_hosts_delete_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "hostName": _SERIALIZER.url("host_name", host_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4638,7 +4766,7 @@ def build_dedicated_hosts_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_dedicated_hosts_get_request( @@ -4660,20 +4788,22 @@ def build_dedicated_hosts_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), "hostName": _SERIALIZER.url("host_name", host_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if expand is not None: _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4681,24 +4811,28 @@ def build_dedicated_hosts_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_hosts_list_by_host_group_request( # pylint: disable=name-too-long - resource_group_name: str, host_group_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_hosts_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "hostName": _SERIALIZER.url("host_name", host_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4707,30 +4841,35 @@ def build_dedicated_hosts_list_by_host_group_request( # pylint: disable=name-to _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_hosts_restart_request( +def build_dedicated_hosts_update_request( resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), "hostName": _SERIALIZER.url("host_name", host_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4739,12 +4878,14 @@ def build_dedicated_hosts_restart_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_dedicated_hosts_redeploy_request( +def build_dedicated_hosts_delete_request( resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4756,13 +4897,15 @@ def build_dedicated_hosts_redeploy_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/redeploy", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str", pattern=r"^[-\w\._]+$"), - "hostName": _SERIALIZER.url("host_name", host_name, "str", pattern=r"^[-\w\._]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "hostName": _SERIALIZER.url("host_name", host_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4773,7 +4916,7 @@ def build_dedicated_hosts_redeploy_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_dedicated_hosts_list_available_sizes_request( # pylint: disable=name-too-long @@ -4789,12 +4932,14 @@ def build_dedicated_hosts_list_available_sizes_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/hostSizes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str", pattern=r"^[-\w\._]+$"), - "hostName": _SERIALIZER.url("host_name", host_name, "str", pattern=r"^[-\w\._]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "hostName": _SERIALIZER.url("host_name", host_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4808,8 +4953,8 @@ def build_dedicated_hosts_list_available_sizes_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_keys_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any +def build_dedicated_hosts_redeploy_request( + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4818,9 +4963,17 @@ def build_ssh_public_keys_list_by_subscription_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/redeploy", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "hostName": _SERIALIZER.url("host_name", host_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4831,11 +4984,11 @@ def build_ssh_public_keys_list_by_subscription_request( # pylint: disable=name- # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_keys_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_dedicated_hosts_restart_request( + resource_group_name: str, host_group_name: str, host_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4846,11 +4999,15 @@ def build_ssh_public_keys_list_by_resource_group_request( # pylint: disable=nam # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostGroupName": _SERIALIZER.url("host_group_name", host_group_name, "str"), + "hostName": _SERIALIZER.url("host_name", host_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4861,45 +5018,59 @@ def build_ssh_public_keys_list_by_resource_group_request( # pylint: disable=nam # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_keys_create_request( - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +def build_restore_points_get_request( + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.RestorePointExpandOptions]] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_keys_update_request( - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +def build_restore_points_create_request( + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4911,12 +5082,17 @@ def build_ssh_public_keys_update_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4929,11 +5105,15 @@ def build_ssh_public_keys_update_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_keys_delete_request( - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +def build_restore_points_delete_request( + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4944,12 +5124,17 @@ def build_ssh_public_keys_delete_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "restorePointCollectionName": _SERIALIZER.url( + "restore_point_collection_name", restore_point_collection_name, "str" + ), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4963,8 +5148,8 @@ def build_ssh_public_keys_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_keys_get_request( - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4975,12 +5160,14 @@ def build_ssh_public_keys_get_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4991,28 +5178,29 @@ def build_ssh_public_keys_get_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_ssh_public_keys_generate_key_pair_request( # pylint: disable=name-too-long - resource_group_name: str, ssh_public_key_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "sshPublicKeyName": _SERIALIZER.url("ssh_public_key_name", ssh_public_key_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5021,32 +5209,31 @@ def build_ssh_public_keys_generate_key_pair_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_create_or_update_request( - resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_rolling_upgrades_cancel_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5055,32 +5242,31 @@ def build_images_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_update_request( - resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5089,15 +5275,13 @@ def build_images_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_delete_request( - resource_group_name: str, image_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_extensions_list_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5108,12 +5292,14 @@ def build_images_delete_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5124,11 +5310,17 @@ def build_images_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_get_request( - resource_group_name: str, image_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +def build_virtual_machine_scale_set_extensions_get_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5139,20 +5331,23 @@ def build_images_get_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "imageName": _SERIALIZER.url("image_name", image_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if expand is not None: _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -5160,23 +5355,28 @@ def build_images_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_extensions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5185,22 +5385,35 @@ def build_images_list_by_resource_group_request( # pylint: disable=name-too-lon _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_images_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_virtual_machine_scale_set_extensions_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5209,32 +5422,34 @@ def build_images_list_request(subscription_id: str, **kwargs: Any) -> HttpReques _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_point_collections_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_extensions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "vmssExtensionName": _SERIALIZER.url("vmss_extension_name", vmss_extension_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5243,33 +5458,39 @@ def build_restore_point_collections_create_or_update_request( # pylint: disable _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_point_collections_update_request( # pylint: disable=name-too-long - resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_list_request( # pylint: disable=name-too-long + resource_group_name: str, + virtual_machine_scale_set_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "virtualMachineScaleSetName": _SERIALIZER.url( + "virtual_machine_scale_set_name", virtual_machine_scale_set_name, "str" ), } @@ -5277,20 +5498,30 @@ def build_restore_point_collections_update_request( # pylint: disable=name-too- # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if select is not None: + _params["$select"] = _SERIALIZER.query("select", select, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_point_collections_delete_request( # pylint: disable=name-too-long - resource_group_name: str, restore_point_collection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) +def build_virtual_machine_scale_set_vms_get_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) accept = _headers.pop("Accept", "application/json") @@ -5298,69 +5529,86 @@ def build_restore_point_collections_delete_request( # pylint: disable=name-too- # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_point_collections_get_request( # pylint: disable=name-too-long +def build_virtual_machine_scale_set_vms_update_request( # pylint: disable=name-too-long resource_group_name: str, - restore_point_collection_name: str, + vm_scale_set_name: str, + instance_id: str, subscription_id: str, *, - expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_point_collections_list_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5371,26 +5619,32 @@ def build_restore_point_collections_list_request( # pylint: disable=name-too-lo # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_deletion is not None: + _params["forceDeletion"] = _SERIALIZER.query("force_deletion", force_deletion, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_point_collections_list_all_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5400,10 +5654,16 @@ def build_restore_point_collections_list_all_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections" + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/approveRollingUpgrade", ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5414,15 +5674,11 @@ def build_restore_point_collections_list_all_request( # pylint: disable=name-to # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_points_create_request( - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5434,15 +5690,15 @@ def build_restore_points_create_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/attachDetachDataDisks", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5455,15 +5711,11 @@ def build_restore_points_create_request( _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_points_delete_request( - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machine_scale_set_vms_deallocate_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5474,15 +5726,15 @@ def build_restore_points_delete_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5493,17 +5745,11 @@ def build_restore_points_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_restore_points_get_request( - resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.RestorePointExpandOptions]] = None, - **kwargs: Any +def build_virtual_machine_scale_set_vms_get_instance_view_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5514,22 +5760,20 @@ def build_restore_points_get_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/instanceView", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "restorePointCollectionName": _SERIALIZER.url( - "restore_point_collection_name", restore_point_collection_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -5538,27 +5782,27 @@ def build_restore_points_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservation_groups_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_perform_maintenance_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/performMaintenance", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5567,51 +5811,55 @@ def build_capacity_reservation_groups_create_or_update_request( # pylint: disab _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservation_groups_update_request( # pylint: disable=name-too-long - resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_power_off_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + skip_shutdown: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/powerOff", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_shutdown is not None: + _params["skipShutdown"] = _SERIALIZER.query("skip_shutdown", skip_shutdown, "bool") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservation_groups_delete_request( # pylint: disable=name-too-long - resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vms_redeploy_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5622,14 +5870,15 @@ def build_capacity_reservation_groups_delete_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/redeploy", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5640,55 +5889,48 @@ def build_capacity_reservation_groups_delete_request( # pylint: disable=name-to # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservation_groups_get_request( # pylint: disable=name-too-long - resource_group_name: str, - capacity_reservation_group_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.CapacityReservationGroupInstanceViewTypes]] = None, - **kwargs: Any +def build_virtual_machine_scale_set_vms_reimage_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservation_groups_list_by_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - **kwargs: Any +def build_virtual_machine_scale_set_vms_reimage_all_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5699,32 +5941,30 @@ def build_capacity_reservation_groups_list_by_resource_group_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservation_groups_list_by_subscription_request( # pylint: disable=name-too-long - subscription_id: str, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, - **kwargs: Any +def build_virtual_machine_scale_set_vms_restart_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5734,74 +5974,75 @@ def build_capacity_reservation_groups_list_by_subscription_request( # pylint: d # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups" - ) # pylint: disable=line-too-long + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/restart", + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - if resource_ids_only is not None: - _params["resourceIdsOnly"] = _SERIALIZER.query("resource_ids_only", resource_ids_only, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservations_create_or_update_request( # pylint: disable=name-too-long +def build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( # pylint: disable=name-too-long resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, + vm_scale_set_name: str, + instance_id: str, subscription_id: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/retrieveBootDiagnosticsData", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if sas_uri_expiration_time_in_minutes is not None: + _params["sasUriExpirationTimeInMinutes"] = _SERIALIZER.query( + "sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, "int" + ) # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservations_update_request( # pylint: disable=name-too-long - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machine_scale_set_vms_run_command_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5813,15 +6054,15 @@ def build_capacity_reservations_update_request( # pylint: disable=name-too-long # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommand", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5834,15 +6075,11 @@ def build_capacity_reservations_update_request( # pylint: disable=name-too-long _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservations_delete_request( # pylint: disable=name-too-long - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machine_scale_set_vms_simulate_eviction_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5853,15 +6090,15 @@ def build_capacity_reservations_delete_request( # pylint: disable=name-too-long # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5872,17 +6109,11 @@ def build_capacity_reservations_delete_request( # pylint: disable=name-too-long # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservations_get_request( - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.CapacityReservationInstanceViewTypes]] = None, - **kwargs: Any +def build_virtual_machine_scale_set_vms_start_request( # pylint: disable=name-too-long + resource_group_name: str, vm_scale_set_name: str, instance_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5893,32 +6124,36 @@ def build_capacity_reservations_get_request( # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/start", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "capacityReservationName": _SERIALIZER.url("capacity_reservation_name", capacity_reservation_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_capacity_reservations_list_by_capacity_reservation_group_request( # pylint: disable=name-too-long - resource_group_name: str, capacity_reservation_group_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_extensions_list_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5929,20 +6164,23 @@ def build_capacity_reservations_list_by_capacity_reservation_group_request( # p # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "capacityReservationGroupName": _SERIALIZER.url( - "capacity_reservation_group_name", capacity_reservation_group_name, "str" + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -5950,41 +6188,57 @@ def build_capacity_reservations_list_by_capacity_reservation_group_request( # p return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_log_analytics_export_request_rate_by_interval_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_extensions_get_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_log_analytics_export_throttled_requests_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_extensions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5996,11 +6250,16 @@ def build_log_analytics_export_throttled_requests_request( # pylint: disable=na # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6013,25 +6272,37 @@ def build_log_analytics_export_throttled_requests_request( # pylint: disable=na _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_run_commands_list_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_extensions_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - accept = _headers.pop("Accept", "application/json, text/json") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" - ) # pylint: disable=line-too-long + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6040,29 +6311,40 @@ def build_virtual_machine_run_commands_list_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_run_commands_get_request( # pylint: disable=name-too-long - location: str, command_id: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_extensions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - accept = _headers.pop("Accept", "application/json, text/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}", + ) path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), - "commandId": _SERIALIZER.url("command_id", command_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6073,98 +6355,123 @@ def build_virtual_machine_run_commands_get_request( # pylint: disable=name-too- # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_run_commands_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_run_commands_list_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json, text/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_run_commands_update_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_run_commands_get_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json, text/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_run_commands_delete_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, run_command_name: str, subscription_id: str, **kwargs: Any +def build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - accept = _headers.pop("Accept", "application/json, text/json") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6173,191 +6480,195 @@ def build_virtual_machine_run_commands_delete_request( # pylint: disable=name-t _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_run_commands_get_by_virtual_machine_request( # pylint: disable=name-too-long +def build_virtual_machine_scale_set_vm_run_commands_update_request( # pylint: disable=name-too-long resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, subscription_id: str, - *, - expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - accept = _headers.pop("Accept", "application/json, text/json") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_run_commands_list_by_virtual_machine_request( # pylint: disable=name-too-long - resource_group_name: str, vm_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +def build_virtual_machine_scale_set_vm_run_commands_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - accept = _headers.pop("Accept", "application/json, text/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machine_extensions_list_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json, text/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_run_commands_update_request( # pylint: disable=name-too-long +def build_virtual_machine_extensions_get_request( # pylint: disable=name-too-long resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, + vm_name: str, + vm_extension_name: str, subscription_id: str, + *, + expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json, text/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_run_commands_delete_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - subscription_id: str, - **kwargs: Any +def build_virtual_machine_extensions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - accept = _headers.pop("Accept", "application/json, text/json") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6366,91 +6677,82 @@ def build_virtual_machine_scale_set_vm_run_commands_delete_request( # pylint: d _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_run_commands_get_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - subscription_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any +def build_virtual_machine_extensions_update_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - accept = _headers.pop("Accept", "application/json, text/json") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_virtual_machine_scale_set_vm_run_commands_list_request( # pylint: disable=name-too-long - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - subscription_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any +def build_virtual_machine_extensions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, vm_name: str, vm_extension_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-01")) - accept = _headers.pop("Accept", "application/json, text/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vmScaleSetName": _SERIALIZER.url("vm_scale_set_name", vm_scale_set_name, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "vmName": _SERIALIZER.url("vm_name", vm_name, "str"), + "vmExtensionName": _SERIALIZER.url("vm_extension_name", vm_extension_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class Operations: @@ -6467,27 +6769,25 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.ComputeOperationValue"]: - """Gets a list of compute operations. + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. - :return: An iterator like instance of either ComputeOperationValue or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.ComputeOperationValue] + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ComputeOperationListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6525,11 +6825,11 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -6549,42 +6849,44 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class UsageOperations: +class AvailabilitySetsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`usage` attribute. + :attr:`availability_sets` attribute. """ models = _models def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: - """Gets, for the specified location, the current compute resource usage information as well as the - limits for compute resources under the subscription. + def list_by_subscription( + self, *, expand: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.AvailabilitySet"]: + """Lists all availability sets in a subscription. - :param location: The location for which resource usage is queried. Required. - :type location: str - :return: An iterator like instance of either Usage or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.Usage] + :keyword expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. Default value is None. + :paramtype expand: str + :return: An iterator like instance of either AvailabilitySet or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) + cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6597,9 +6899,9 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: def prepare_request(next_link=None): if not next_link: - _request = build_usage_list_request( - location=location, + _request = build_availability_sets_list_by_subscription_request( subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -6624,7 +6926,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("ListUsagesResult", pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -6647,43 +6949,22 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class VirtualMachineSizesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machine_sizes` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - @distributed_trace - def list(self, location: str, **kwargs: Any) -> Iterable["_models.VirtualMachineSize"]: - """This API is deprecated. Use `Resources Skus - `_. + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.AvailabilitySet"]: + """Lists all availability sets in a resource group. - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either AvailabilitySet or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6696,8 +6977,8 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.VirtualMachine def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_sizes_list_request( - location=location, + _request = build_availability_sets_list_request( + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -6723,11 +7004,11 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) + deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -6746,46 +7027,19 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + @distributed_trace + def get(self, resource_group_name: str, availability_set_name: str, **kwargs: Any) -> _models.AvailabilitySet: + """Retrieves information about an availability set. -class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machine_scale_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.VirtualMachineScaleSet"]: - """Gets all the VM scale sets under the specified subscription for the specified location. - - :param location: The location for which VM scale sets under the subscription are queried. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :return: An iterator like instance of either VirtualMachineScaleSet or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6794,69 +7048,116 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Vi } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_virtual_machine_scale_sets_list_by_location_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _request = build_availability_sets_get_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore - def _create_or_update_initial( + @overload + def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSet, IO[bytes]], + availability_set_name: str, + parameters: _models.AvailabilitySet, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> Iterator[bytes]: + ) -> _models.AvailabilitySet: + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: Union[_models.AvailabilitySet, IO[bytes]], + **kwargs: Any + ) -> _models.AvailabilitySet: + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. Is either a + AvailabilitySet type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet or IO[bytes] + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6870,7 +7171,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -6878,14 +7179,12 @@ def _create_or_update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "VirtualMachineScaleSet") + _json = self._serialize.body(parameters, "AvailabilitySet") - _request = build_virtual_machine_scale_sets_create_or_update_request( + _request = build_availability_sets_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, api_version=api_version, content_type=content_type, json=_json, @@ -6895,23 +7194,18 @@ def _create_or_update_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -6919,172 +7213,246 @@ def _create_or_update_initial( return deserialized # type: ignore @overload - def begin_create_or_update( + def update( self, resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VirtualMachineScaleSet, + availability_set_name: str, + parameters: _models.AvailabilitySetUpdate, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSet]: - """Create or update a VM scale set. + ) -> _models.AvailabilitySet: + """Update an availability set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set to create or update. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySetUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def update( self, resource_group_name: str, - vm_scale_set_name: str, + availability_set_name: str, parameters: IO[bytes], *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSet]: - """Create or update a VM scale set. + ) -> _models.AvailabilitySet: + """Update an availability set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set to create or update. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Required. :type parameters: IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def update( self, resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSet, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + availability_set_name: str, + parameters: Union[_models.AvailabilitySetUpdate, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSet]: - """Create or update a VM scale set. + ) -> _models.AvailabilitySet: + """Update an availability set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set to create or update. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Is either a VirtualMachineScaleSet type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet or IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. Is either a + AvailabilitySetUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySetUpdate or IO[bytes] + :return: AvailabilitySet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineScaleSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineScaleSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + _json = self._serialize.body(parameters, "AvailabilitySetUpdate") + + _request = build_availability_sets_update_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, ) + _request.url = self._client.format_url(_request.url) - def _update_initial( + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, availability_set_name: str, **kwargs: Any + ) -> None: + """Delete an availability set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_availability_sets_delete_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long + self, resource_group_name: str, availability_set_name: str, **kwargs: Any + ) -> None: + """Cancel the migration operation on an Availability Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSetUpdate, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + availability_set_name: str, + parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, IO[bytes]]] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -7108,14 +7476,15 @@ def _update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "VirtualMachineScaleSetUpdate") + if parameters is not None: + _json = self._serialize.body(parameters, "ConvertToVirtualMachineScaleSetInput") + else: + _json = None - _request = build_virtual_machine_scale_sets_update_request( + _request = build_availability_sets_convert_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, api_version=api_version, content_type=content_type, json=_json, @@ -7133,7 +7502,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -7141,122 +7510,97 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_update( + def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VirtualMachineScaleSetUpdate, + availability_set_name: str, + parameters: Optional[_models.ConvertToVirtualMachineScaleSetInput] = None, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSet]: - """Update a VM scale set. + ) -> LROPoller[None]: + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set to create or update. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetUpdate - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ConvertToVirtualMachineScaleSetInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], + availability_set_name: str, + parameters: Optional[IO[bytes]] = None, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSet]: - """Update a VM scale set. + ) -> LROPoller[None]: + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set to create or update. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Required. + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Default value is None. :type parameters: IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VirtualMachineScaleSetUpdate, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + availability_set_name: str, + parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, IO[bytes]]] = None, **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSet]: - """Update a VM scale set. + ) -> LROPoller[None]: + """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the + Availability Set. This does not trigger a downtime on the Virtual Machines. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set to create or update. Required. - :type vm_scale_set_name: str - :param parameters: The scale set object. Is either a VirtualMachineScaleSetUpdate type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetUpdate or - IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is + either a ConvertToVirtualMachineScaleSetInput type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ConvertToVirtualMachineScaleSetInput + or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -7264,17 +7608,15 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._convert_to_virtual_machine_scale_set_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + availability_set_name=availability_set_name, parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -7285,32 +7627,112 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachineScaleSet].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachineScaleSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> Iterator[bytes]: + @overload + def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: _models.MigrateToVirtualMachineScaleSetInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, IO[bytes]], + **kwargs: Any + ) -> None: + """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual + Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that + triggers a downtime on the Virtual Machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is + either a MigrateToVirtualMachineScaleSetInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput + or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7319,179 +7741,130 @@ def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrateToVirtualMachineScaleSetInput") + + _request = build_availability_sets_start_migration_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, - force_deletion=force_deletion, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, vm_scale_set_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a VM scale set. + return cls(pipeline_response, None, {}) # type: ignore - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :keyword force_deletion: Optional parameter to force delete a VM scale set. (Feature in - Preview). Default value is None. - :paramtype force_deletion: bool - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + @overload + def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + self, + resource_group_name: str, + availability_set_name: str, + parameters: _models.MigrateToVirtualMachineScaleSetInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - force_deletion=force_deletion, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def get( + @overload + def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long self, resource_group_name: str, - vm_scale_set_name: str, + availability_set_name: str, + parameters: IO[bytes], *, - expand: Optional[Union[str, _models.ExpandTypesForGetVMScaleSets]] = None, + content_type: str = "application/json", **kwargs: Any - ) -> _models.VirtualMachineScaleSet: - """Display information about a virtual machine scale set. + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :keyword expand: The expand expression to apply on the operation. 'UserData' retrieves the - UserData property of the VM scale set that was provided by the user during the VM scale set - Create/Update operation. "userData" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForGetVMScaleSets - :return: VirtualMachineScaleSet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_sets_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - def _deallocate_initial( + @distributed_trace + def validate_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - *, - hibernate: Optional[bool] = None, + availability_set_name: str, + parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: + ) -> None: + """Validates that the Virtual Machines in the Availability Set can be migrated to the provided + Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :param parameters: Parameters supplied to the migrate operation on the availability set. Is + either a MigrateToVirtualMachineScaleSetInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput + or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7505,24 +7878,20 @@ def _deallocate_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None + _json = self._serialize.body(parameters, "MigrateToVirtualMachineScaleSetInput") - _request = build_virtual_machine_scale_sets_deallocate_request( + _request = build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + availability_set_name=availability_set_name, subscription_id=self._config.subscription_id, - hibernate=hibernate, api_version=api_version, content_type=content_type, json=_json, @@ -7532,181 +7901,42 @@ def _deallocate_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - @overload - def begin_deallocate( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - hibernate: Optional[bool] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and - releases the compute resources. You are not billed for the compute resources that this virtual - machine scale set deallocates. + @distributed_trace + def list_available_sizes( + self, resource_group_name: str, availability_set_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualMachineSize"]: + """Lists all available virtual machine sizes that can be used to create a new virtual machine in + an existing availability set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs - :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. - (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is - None. - :paramtype hibernate: bool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param availability_set_name: The name of the availability set. Required. + :type availability_set_name: str + :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] :raises ~azure.core.exceptions.HttpResponseError: """ - - @overload - def begin_deallocate( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - hibernate: Optional[bool] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and - releases the compute resources. You are not billed for the compute resources that this virtual - machine scale set deallocates. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] - :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. - (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is - None. - :paramtype hibernate: bool - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_deallocate( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - *, - hibernate: Optional[bool] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and - releases the compute resources. You are not billed for the compute resources that this virtual - machine scale set deallocates. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. - (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is - None. - :paramtype hibernate: bool - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._deallocate_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - hibernate=hibernate, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) - def _delete_instances_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - *, - force_deletion: Optional[bool] = None, - **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7715,265 +7945,118 @@ def _delete_instances_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + _request = build_availability_sets_list_available_sizes_request( + resource_group_name=resource_group_name, + availability_set_name=availability_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceRequiredIDs") + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _request = build_virtual_machine_scale_sets_delete_instances_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - force_deletion=force_deletion, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def get_next(next_link=None): + _request = prepare_request(next_link) - response = pipeline_response.http_response + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if response.status_code not in [200, 202]: - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + return pipeline_response - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return ItemPaged(get_next, extract_data) - return deserialized # type: ignore - @overload - def begin_delete_instances( +class CapacityReservationGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`capacity_reservation_groups` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_subscription( self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, *, - force_deletion: Optional[bool] = None, - content_type: str = "application/json", + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, **kwargs: Any - ) -> LROPoller[None]: - """Deletes virtual machines in a VM scale set. + ) -> Iterable["_models.CapacityReservationGroup"]: + """Lists all of the capacity reservation groups in the subscription. Use the nextLink property in + the response to get the next page of capacity reservation groups. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - Required. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs - :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale - set. (Feature in Preview). Default value is None. - :paramtype force_deletion: bool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :keyword expand: The expand expression to apply on the operation. Based on the expand param(s) + specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are + associated to capacity reservation group in the response. Known values are: + "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. + :paramtype expand: str or + ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForGetCapacityReservationGroups + :keyword resource_ids_only: The query option to fetch Capacity Reservation Group Resource Ids. + :code:`
    ` 'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation + group resources created in the subscription. :code:`
    ` 'SharedWithSubscription' enables + fetching Resource Ids for all capacity reservation group resources shared with the + subscription. :code:`
    ` 'All' enables fetching Resource Ids for all capacity reservation + group resources shared with the subscription and created in the subscription. Known values are: + "CreatedInSubscription", "SharedWithSubscription", and "All". Default value is None. + :paramtype resource_ids_only: str or + ~azure.mgmt.compute.v2024_11_01.models.ResourceIdOptionsForGetCapacityReservationGroups + :return: An iterator like instance of either CapacityReservationGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup] :raises ~azure.core.exceptions.HttpResponseError: """ - - @overload - def begin_delete_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: IO[bytes], - *, - force_deletion: Optional[bool] = None, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Deletes virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - Required. - :type vm_instance_i_ds: IO[bytes] - :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale - set. (Feature in Preview). Default value is None. - :paramtype force_deletion: bool - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_delete_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - *, - force_deletion: Optional[bool] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceRequiredIDs type or a IO[bytes] type. Required. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs or IO[bytes] - :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale - set. (Feature in Preview). Default value is None. - :paramtype force_deletion: bool - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_instances_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - force_deletion=force_deletion, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get_instance_view( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> _models.VirtualMachineScaleSetInstanceView: - """Gets the status of a VM scale set instance. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: VirtualMachineScaleSetInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetInstanceView] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_sets_get_instance_view_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualMachineScaleSet"]: - """Gets a list of all VM scale sets under a resource group. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :return: An iterator like instance of either VirtualMachineScaleSet or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationGroupListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7986,9 +8069,10 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Vir def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_scale_sets_list_request( - resource_group_name=resource_group_name, + _request = build_capacity_reservation_groups_list_by_subscription_request( subscription_id=self._config.subscription_id, + expand=expand, + resource_ids_only=resource_ids_only, api_version=api_version, headers=_headers, params=_params, @@ -8013,7 +8097,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) + deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -8037,22 +8121,36 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_all(self, **kwargs: Any) -> Iterable["_models.VirtualMachineScaleSet"]: - """Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource - group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this - till nextLink is null to fetch all the VM Scale Sets. + def list_by_resource_group( + self, + resource_group_name: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, + **kwargs: Any + ) -> Iterable["_models.CapacityReservationGroup"]: + """Lists all of the capacity reservation groups in the specified resource group. Use the nextLink + property in the response to get the next page of capacity reservation groups. - :return: An iterator like instance of either VirtualMachineScaleSet or the result of + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword expand: The expand expression to apply on the operation. Based on the expand param(s) + specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are + associated to capacity reservation group in the response. Known values are: + "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. + :paramtype expand: str or + ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForGetCapacityReservationGroups + :return: An iterator like instance of either CapacityReservationGroup or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetListWithLinkResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationGroupListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8065,8 +8163,10 @@ def list_all(self, **kwargs: Any) -> Iterable["_models.VirtualMachineScaleSet"]: def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_scale_sets_list_all_request( + _request = build_capacity_reservation_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -8091,7 +8191,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) + deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -8115,28 +8215,32 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_skus( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> Iterable["_models.VirtualMachineScaleSetSku"]: - """Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM - instances allowed for each SKU. + def get( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + *, + expand: Optional[Union[str, _models.CapacityReservationGroupInstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation that retrieves information about a capacity reservation group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An iterator like instance of either VirtualMachineScaleSetSku or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetSku] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve + the list of instance views of the capacity reservations under the capacity reservation group + which is a snapshot of the runtime properties of a capacity reservation that is managed by the + platform and can change outside of control plane operations. "instanceView" Default value is + None. + :paramtype expand: str or + ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroupInstanceViewTypes + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetListSkusResult] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8145,153 +8249,123 @@ def list_skus( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_virtual_machine_scale_sets_list_skus_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _request = build_capacity_reservation_groups_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore - @distributed_trace - def get_os_upgrade_history( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> Iterable["_models.UpgradeOperationHistoricalStatusInfo"]: - """Gets list of OS upgrades on a VM scale set instance. + @overload + def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: _models.CapacityReservationGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An iterator like instance of either UpgradeOperationHistoricalStatusInfo or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.UpgradeOperationHistoricalStatusInfo] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetListOSUpgradeHistory] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machine_scale_sets_get_os_upgrade_history_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return pipeline_response + @overload + def create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + https://aka.ms/CapacityReservation for more details. - return ItemPaged(get_next, extract_data) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ - def _power_off_initial( + @distributed_trace + def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - *, - skip_shutdown: bool = False, + capacity_reservation_group_name: str, + parameters: Union[_models.CapacityReservationGroup, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: + ) -> _models.CapacityReservationGroup: + """The operation to create or update a capacity reservation group. When updating a capacity + reservation group, only tags and sharing profile may be modified. Please refer to + https://aka.ms/CapacityReservation for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. Is either a + CapacityReservationGroup type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup or IO[bytes] + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8305,24 +8379,20 @@ def _power_off_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None + _json = self._serialize.body(parameters, "CapacityReservationGroup") - _request = build_virtual_machine_scale_sets_power_off_request( + _request = build_capacity_reservation_groups_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, api_version=api_version, content_type=content_type, json=_json, @@ -8332,23 +8402,18 @@ def _power_off_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8356,158 +8421,87 @@ def _power_off_initial( return deserialized # type: ignore @overload - def begin_power_off( + def update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + capacity_reservation_group_name: str, + parameters: _models.CapacityReservationGroupUpdate, *, - skip_shutdown: bool = False, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still - attached and you are getting charged for the resources. Instead, use deallocate to release - resources and avoid charges. Additionally, this operation is not allowed on virtual machines in - a VM scale set that are being deallocated or have already been deallocated. + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs - :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this - flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. Default value is False. - :paramtype skip_shutdown: bool + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_power_off( + def update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, + capacity_reservation_group_name: str, + parameters: IO[bytes], *, - skip_shutdown: bool = False, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still - attached and you are getting charged for the resources. Instead, use deallocate to release - resources and avoid charges. Additionally, this operation is not allowed on virtual machines in - a VM scale set that are being deallocated or have already been deallocated. + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] - :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this - flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. Default value is False. - :paramtype skip_shutdown: bool + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. + Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_power_off( + def update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - *, - skip_shutdown: bool = False, + capacity_reservation_group_name: str, + parameters: Union[_models.CapacityReservationGroupUpdate, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still - attached and you are getting charged for the resources. Instead, use deallocate to release - resources and avoid charges. Additionally, this operation is not allowed on virtual machines in - a VM scale set that are being deallocated or have already been deallocated. + ) -> _models.CapacityReservationGroup: + """The operation to update a capacity reservation group. When updating a capacity reservation + group, only tags and sharing profile may be modified. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this - flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. Default value is False. - :paramtype skip_shutdown: bool - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. Is + either a CapacityReservationGroupUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroupUpdate or + IO[bytes] + :return: CapacityReservationGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._power_off_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - skip_shutdown=skip_shutdown, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _restart_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8521,22 +8515,19 @@ def _restart_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None + _json = self._serialize.body(parameters, "CapacityReservationGroupUpdate") - _request = build_virtual_machine_scale_sets_restart_request( + _request = build_capacity_reservation_groups_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -8547,339 +8538,116 @@ def _restart_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_restart( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Restarts one or more virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_restart( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Restarts one or more virtual machines in a VM scale set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_restart( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Restarts one or more virtual machines in a VM scale set. + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any + ) -> None: + """The operation to delete a capacity reservation group. This operation is allowed only if all the + associated resources are disassociated from the reservation group and all capacity reservations + under the reservation group have also been deleted. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None - _request = build_virtual_machine_scale_sets_start_request( + _request = build_capacity_reservation_groups_delete_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - return deserialized # type: ignore - @overload - def begin_start( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Starts one or more virtual machines in a VM scale set. +class DedicatedHostGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`dedicated_host_groups` attribute. + """ - @overload - def begin_start( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Starts one or more virtual machines in a VM scale set. + models = _models - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def begin_start( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Starts one or more virtual machines in a VM scale set. + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DedicatedHostGroup"]: + """Lists all of the dedicated host groups in the subscription. Use the nextLink property in the + response to get the next page of dedicated host groups. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An iterator like instance of either DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + cls: ClsType[_models.DedicatedHostGroupListResult] = kwargs.pop("cls", None) - def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8888,111 +8656,162 @@ def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **k } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + _request = build_dedicated_host_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machine_scale_sets_reapply_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def begin_reapply(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> LROPoller[None]: - """Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine - Instances. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.DedicatedHostGroup"]: + """Lists all of the dedicated host groups in the specified resource group. Use the nextLink + property in the response to get the next page of dedicated host groups. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An iterator like instance of either DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._reapply_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.DedicatedHostGroupListResult] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_dedicated_host_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response - def _redeploy_initial( + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + host_group_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, **kwargs: Any - ) -> Iterator[bytes]: + ) -> _models.DedicatedHostGroup: + """Retrieves information about a dedicated host group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve + the list of instance views of the dedicated hosts under the dedicated host group. 'UserData' is + not supported for dedicated host group. Known values are: "instanceView", "userData", and + "resiliencyView". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9001,54 +8820,35 @@ def _redeploy_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds - else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_redeploy_request( + _request = build_dedicated_host_groups_get_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9056,135 +8856,87 @@ def _redeploy_initial( return deserialized # type: ignore @overload - def begin_redeploy( + def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + host_group_name: str, + parameters: _models.DedicatedHostGroup, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, - and powers them back on. + ) -> _models.DedicatedHostGroup: + """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host + Groups please see [Dedicated Host Documentation] + (https://go.microsoft.com/fwlink/?linkid=2082596). - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_redeploy( + def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, + host_group_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, - and powers them back on. + ) -> _models.DedicatedHostGroup: + """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host + Groups please see [Dedicated Host Documentation] + (https://go.microsoft.com/fwlink/?linkid=2082596). - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_redeploy( + def create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + host_group_name: str, + parameters: Union[_models.DedicatedHostGroup, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, - and powers them back on. + ) -> _models.DedicatedHostGroup: + """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host + Groups please see [Dedicated Host Documentation] + (https://go.microsoft.com/fwlink/?linkid=2082596). - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. Is either a + DedicatedHostGroup type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup or IO[bytes] + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._redeploy_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _perform_maintenance_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9198,22 +8950,19 @@ def _perform_maintenance_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None + _json = self._serialize.body(parameters, "DedicatedHostGroup") - _request = build_virtual_machine_scale_sets_perform_maintenance_request( + _request = build_dedicated_host_groups_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -9224,23 +8973,18 @@ def _perform_maintenance_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9248,141 +8992,81 @@ def _perform_maintenance_initial( return deserialized # type: ignore @overload - def begin_perform_maintenance( + def update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + host_group_name: str, + parameters: _models.DedicatedHostGroupUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances - which are not eligible for perform maintenance will be failed. Please refer to best practices - for more details: - https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_perform_maintenance( + def update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, + host_group_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances - which are not eligible for perform maintenance will be failed. Please refer to best practices - for more details: - https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_perform_maintenance( + def update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + host_group_name: str, + parameters: Union[_models.DedicatedHostGroupUpdate, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances - which are not eligible for perform maintenance will be failed. Please refer to best practices - for more details: - https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + ) -> _models.DedicatedHostGroup: + """Update an dedicated host group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Is either + a DedicatedHostGroupUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroupUpdate or IO[bytes] + :return: DedicatedHostGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._perform_maintenance_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_instances_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9396,19 +9080,19 @@ def _update_instances_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceRequiredIDs") + _json = self._serialize.body(parameters, "DedicatedHostGroupUpdate") - _request = build_virtual_machine_scale_sets_update_instances_request( + _request = build_dedicated_host_groups_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -9419,156 +9103,39 @@ def _update_instances_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_update_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - Required. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. - Required. - :type vm_instance_i_ds: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_update_instances( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, host_group_name: str, **kwargs: Any + ) -> None: + """Delete a dedicated host group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceRequiredIDs type or a IO[bytes] type. Required. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_instances_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _reimage_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[Union[_models.VirtualMachineScaleSetReimageParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9577,190 +9144,273 @@ def _reimage_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vm_scale_set_reimage_input, (IOBase, bytes)): - _content = vm_scale_set_reimage_input - else: - if vm_scale_set_reimage_input is not None: - _json = self._serialize.body(vm_scale_set_reimage_input, "VirtualMachineScaleSetReimageParameters") - else: - _json = None + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_reimage_request( + _request = build_dedicated_host_groups_delete_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - return deserialized # type: ignore - @overload - def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[_models.VirtualMachineScaleSetReimageParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which - don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual - machine is reset to initial state. +class ImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. - :type vm_scale_set_reimage_input: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetReimageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`images` attribute. + """ - @overload - def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which - don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual - machine is reset to initial state. + models = _models - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. - :type vm_scale_set_reimage_input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def begin_reimage( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_scale_set_reimage_input: Optional[Union[_models.VirtualMachineScaleSetReimageParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which - don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual - machine is reset to initial state. + def list(self, **kwargs: Any) -> Iterable["_models.Image"]: + """Gets the list of Images in the subscription. Use nextLink property in the response to get the + next page of Images. Do this till nextLink is null to fetch all the Images. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Is either a - VirtualMachineScaleSetReimageParameters type or a IO[bytes] type. Default value is None. - :type vm_scale_set_reimage_input: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetReimageParameters or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An iterator like instance of either Image or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._reimage_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_scale_set_reimage_input=vm_scale_set_reimage_input, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + cls: ClsType[_models.ImageListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_images_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ImageListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + response = pipeline_response.http_response - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Image"]: + """Gets the list of images under a resource group. Use nextLink property in the response to get + the next page of Images. Do this till nextLink is null to fetch all the Images. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either Image or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.ImageListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_images_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ImageListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response - def _reimage_all_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, image_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.Image: + """Gets an image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: Image or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.Image + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.Image] = kwargs.pop("cls", None) + + _request = build_images_get_request( + resource_group_name=resource_group_name, + image_name=image_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Image", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, resource_group_name: str, image_name: str, parameters: Union[_models.Image, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9780,17 +9430,14 @@ def _reimage_all_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None + _json = self._serialize.body(parameters, "Image") - _request = build_virtual_machine_scale_sets_reimage_all_request( + _request = build_images_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + image_name=image_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -9809,7 +9456,7 @@ def _reimage_all_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -9817,91 +9464,88 @@ def _reimage_all_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_reimage_all( + def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + image_name: str, + parameters: _models.Image, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This - operation is only supported for managed disks. + ) -> LROPoller[_models.Image]: + """Create or update an image. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.Image :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns either Image or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_reimage_all( + def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, + image_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This - operation is only supported for managed disks. + ) -> LROPoller[_models.Image]: + """Create or update an image. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns either Image or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_reimage_all( - self, - resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This - operation is only supported for managed disks. + def begin_create_or_update( + self, resource_group_name: str, image_name: str, parameters: Union[_models.Image, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.Image]: + """Create or update an image. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. Is either a Image type or + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.Image or IO[bytes] + :return: An instance of LROPoller that returns either Image or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -9909,15 +9553,15 @@ def begin_reimage_all( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Image] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._reimage_all_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, + image_name=image_name, + parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -9928,30 +9572,36 @@ def begin_reimage_all( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Image", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.Image].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.Image]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _approve_rolling_upgrade_initial( + def _update_initial( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + image_name: str, + parameters: Union[_models.ImageUpdate, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -9972,17 +9622,14 @@ def _approve_rolling_upgrade_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_instance_i_ds, (IOBase, bytes)): - _content = vm_instance_i_ds + if isinstance(parameters, (IOBase, bytes)): + _content = parameters else: - if vm_instance_i_ds is not None: - _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") - else: - _json = None + _json = self._serialize.body(parameters, "ImageUpdate") - _request = build_virtual_machine_scale_sets_approve_rolling_upgrade_request( + _request = build_images_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + image_name=image_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -10001,7 +9648,7 @@ def _approve_rolling_upgrade_initial( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -10010,7 +9657,9 @@ def _approve_rolling_upgrade_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -10020,83 +9669,79 @@ def _approve_rolling_upgrade_initial( return deserialized # type: ignore @overload - def begin_approve_rolling_upgrade( + def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + image_name: str, + parameters: _models.ImageUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale - set. + ) -> LROPoller[_models.Image]: + """Update an image. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ImageUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns either Image or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_approve_rolling_upgrade( + def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[IO[bytes]] = None, + image_name: str, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale - set. + ) -> LROPoller[_models.Image]: + """Update an image. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default - value is None. - :type vm_instance_i_ds: IO[bytes] + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Required. + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns either Image or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_approve_rolling_upgrade( + def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + image_name: str, + parameters: Union[_models.ImageUpdate, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale - set. + ) -> LROPoller[_models.Image]: + """Update an image. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is - either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. - :type vm_instance_i_ds: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param image_name: The name of the image. Required. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. Is either a ImageUpdate + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ImageUpdate or IO[bytes] + :return: An instance of LROPoller that returns either Image or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -10104,15 +9749,15 @@ def begin_approve_rolling_upgrade( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Image] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._approve_rolling_upgrade_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vm_instance_i_ds=vm_instance_i_ds, + image_name=image_name, + parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -10123,56 +9768,32 @@ def begin_approve_rolling_upgrade( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Image", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.Image].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def force_recovery_service_fabric_platform_update_domain_walk( # pylint: disable=name-too-long - self, - resource_group_name: str, - vm_scale_set_name: str, - *, - platform_update_domain: int, - zone: Optional[str] = None, - placement_group_id: Optional[str] = None, - **kwargs: Any - ) -> _models.RecoveryWalkResponse: - """Manual platform update domain walk to update virtual machines in a service fabric virtual - machine scale set. + return LROPoller[_models.Image]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :keyword platform_update_domain: The platform update domain for which a manual recovery walk is - requested. Required. - :paramtype platform_update_domain: int - :keyword zone: The zone in which the manual recovery walk is requested for cross zone virtual - machine scale set. Default value is None. - :paramtype zone: str - :keyword placement_group_id: The placement group id for which the manual recovery walk is - requested. Default value is None. - :paramtype placement_group_id: str - :return: RecoveryWalkResponse or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RecoveryWalkResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10185,116 +9806,134 @@ def force_recovery_service_fabric_platform_update_domain_walk( # pylint: disabl _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RecoveryWalkResponse] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk_request( + _request = build_images_delete_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + image_name=image_name, subscription_id=self._config.subscription_id, - platform_update_domain=platform_update_domain, - zone=zone, - placement_group_id=placement_group_id, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RecoveryWalkResponse", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def convert_to_single_placement_group( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.VMScaleSetConvertToSinglePlacementGroupInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + @distributed_trace + def begin_delete(self, resource_group_name: str, image_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes an Image. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_scale_set_name: str - :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. - :type parameters: - ~azure.mgmt.compute.v2024_11_01.models.VMScaleSetConvertToSinglePlacementGroupInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None + :type resource_group_name: str + :param image_name: The name of the image. Required. + :type image_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @overload - def convert_to_single_placement_group( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + image_name=image_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the virtual machine scale set to create or update. - Required. - :type vm_scale_set_name: str - :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class VirtualMachineImagesEdgeZoneOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`virtual_machine_images_edge_zone` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.VMScaleSetConvertToSinglePlacementGroupInput, IO[bytes]], - **kwargs: Any - ) -> None: - """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + def list_publishers( + self, location: str, edge_zone: str, **kwargs: Any + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of virtual machine image publishers for the specified Azure location and edge zone. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the virtual machine scale set to create or update. - Required. - :type vm_scale_set_name: str - :param parameters: The input object for ConvertToSinglePlacementGroup API. Is either a - VMScaleSetConvertToSinglePlacementGroupInput type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.compute.v2024_11_01.models.VMScaleSetConvertToSinglePlacementGroupInput or - IO[bytes] - :return: None or the result of cls(response) - :rtype: None + :param location: The name of Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10305,29 +9944,17 @@ def convert_to_single_placement_group( # pylint: disable=inconsistent-return-st } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VMScaleSetConvertToSinglePlacementGroupInput") + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_convert_to_single_placement_group_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + _request = build_virtual_machine_images_edge_zone_list_publishers_request( + location=location, + edge_zone=edge_zone, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -10344,16 +9971,30 @@ def convert_to_single_placement_group( # pylint: disable=inconsistent-return-st map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore - def _set_orchestration_service_state_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.OrchestrationServiceStateInput, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + return deserialized # type: ignore + + @distributed_trace + def list_offers( + self, location: str, edge_zone: str, publisher_name: str, **kwargs: Any + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of virtual machine image offers for the specified location, edge zone and + publisher. + + :param location: The name of Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10362,206 +10003,143 @@ def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "OrchestrationServiceStateInput") + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_sets_set_orchestration_service_state_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + _request = build_virtual_machine_images_edge_zone_list_offers_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_set_orchestration_service_state( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: _models.OrchestrationServiceStateInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Changes ServiceState property for a given service. + @distributed_trace + def list_skus( + self, location: str, edge_zone: str, publisher_name: str, offer: str, **kwargs: Any + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and + offer. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the virtual machine scale set to create or update. - Required. - :type vm_scale_set_name: str - :param parameters: The input object for SetOrchestrationServiceState API. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.OrchestrationServiceStateInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_orchestration_service_state( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Changes ServiceState property for a given service. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the virtual machine scale set to create or update. - Required. - :type vm_scale_set_name: str - :param parameters: The input object for SetOrchestrationServiceState API. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param location: The name of Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace - def begin_set_orchestration_service_state( - self, - resource_group_name: str, - vm_scale_set_name: str, - parameters: Union[_models.OrchestrationServiceStateInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Changes ServiceState property for a given service. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the virtual machine scale set to create or update. - Required. - :type vm_scale_set_name: str - :param parameters: The input object for SetOrchestrationServiceState API. Is either a - OrchestrationServiceStateInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.OrchestrationServiceStateInput or - IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._set_orchestration_service_state_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + _request = build_virtual_machine_images_edge_zone_list_skus_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response -class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_extensions` attribute. - """ + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) - models = _models + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + return deserialized # type: ignore - def _create_or_update_initial( + @distributed_trace + def list( self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtension, IO[bytes]], + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of all virtual machine image versions for the specified location, edge zone, + publisher, offer, and SKU. + + :param location: The name of Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :keyword top: An integer value specifying the number of images to return that matches supplied + values. Default value is None. + :paramtype top: int + :keyword orderby: Specifies the order of the results returned. Formatted as an OData query. + Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10570,209 +10148,147 @@ def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetExtension") + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_extensions_create_or_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, + _request = build_virtual_machine_images_edge_zone_list_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to create or update an extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be create or - updated. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Create VM scale set Extension - operation. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ + @distributed_trace + def get( + self, location: str, edge_zone: str, publisher_name: str, offer: str, skus: str, version: str, **kwargs: Any + ) -> _models.VirtualMachineImage: + """Gets a virtual machine image in an edge zone. - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to create or update an extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be create or - updated. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Create VM scale set Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] + :param location: The name of Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :param version: A valid image SKU version. Required. + :type version: str + :return: VirtualMachineImage or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtension, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to create or update an extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be create or - updated. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Create VM scale set Extension - operation. Is either a VirtualMachineScaleSetExtension type or a IO[bytes] type. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + _request = build_virtual_machine_images_edge_zone_get_request( + location=location, + edge_zone=edge_zone, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineScaleSetExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualMachineImage", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VirtualMachineImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`virtual_machine_images` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_edge_zone(self, location: str, edge_zone: str, **kwargs: Any) -> _models.VmImagesInEdgeZoneListResult: + """Gets a list of all virtual machine image versions for the specified edge zone. + + :param location: The name of Azure region. Required. + :type location: str + :param edge_zone: The name of the edge zone. Required. + :type edge_zone: str + :return: VmImagesInEdgeZoneListResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VmImagesInEdgeZoneListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10781,205 +10297,105 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetExtensionUpdate") + cls: ClsType[_models.VmImagesInEdgeZoneListResult] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_extensions_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, + _request = build_virtual_machine_images_list_by_edge_zone_request( + location=location, + edge_zone=edge_zone, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("VmImagesInEdgeZoneListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to update an extension. + @distributed_trace + def list_publishers(self, location: str, **kwargs: Any) -> List[_models.VirtualMachineImageResource]: + """Gets a list of virtual machine image publishers for the specified Azure location. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be updated. - Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Update VM scale set Extension - operation. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] + :param location: The name of Azure region. Required. + :type location: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to update an extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be updated. - Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Update VM scale set Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: - """The operation to update an extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be updated. - Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :param extension_parameters: Parameters supplied to the Update VM scale set Extension - operation. Is either a VirtualMachineScaleSetExtensionUpdate type or a IO[bytes] type. - Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtensionUpdate or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + _request = build_virtual_machine_images_list_publishers_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineScaleSetExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any - ) -> Iterator[bytes]: + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_offers( + self, location: str, publisher_name: str, **kwargs: Any + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of virtual machine image offers for the specified location and publisher. + + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10992,12 +10408,11 @@ def _delete_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_extensions_delete_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, + _request = build_virtual_machine_images_list_offers_request( + location=location, + publisher_name=publisher_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -11005,23 +10420,18 @@ def _delete_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11029,85 +10439,19 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace - def begin_delete( - self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any - ) -> LROPoller[None]: - """The operation to delete the extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be deleted. - Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - vm_scale_set_name: str, - vmss_extension_name: str, - *, - expand: Optional[str] = None, - **kwargs: Any - ) -> _models.VirtualMachineScaleSetExtension: - """The operation to get the extension. + def list_skus( + self, location: str, publisher_name: str, offer: str, **kwargs: Any + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set containing the extension. Required. - :type vm_scale_set_name: str - :param vmss_extension_name: The name of the VM scale set extension. Required. - :type vmss_extension_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineScaleSetExtension or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11122,14 +10466,13 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_extensions_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - vmss_extension_name=vmss_extension_name, + _request = build_virtual_machine_images_list_skus_request( + location=location, + publisher_name=publisher_name, + offer=offer, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -11147,7 +10490,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11156,25 +10499,189 @@ def get( @distributed_trace def list( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> Iterable["_models.VirtualMachineScaleSetExtension"]: - """Gets a list of all extensions in a VM scale set. + self, + location: str, + publisher_name: str, + offer: str, + skus: str, + *, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List[_models.VirtualMachineImageResource]: + """Gets a list of all virtual machine image versions for the specified location, publisher, offer, + and SKU. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set containing the extension. Required. - :type vm_scale_set_name: str - :return: An iterator like instance of either VirtualMachineScaleSetExtension or the result of - cls(response) + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineImageResource or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_list_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( + self, location: str, publisher_name: str, offer: str, skus: str, version: str, **kwargs: Any + ) -> _models.VirtualMachineImage: + """Gets a virtual machine image. + + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :param version: A valid image SKU version. Required. + :type version: str + :return: VirtualMachineImage or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) + + _request = build_virtual_machine_images_get_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualMachineImage", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_with_properties( + self, + location: str, + publisher_name: str, + offer: str, + skus: str, + *, + expand: Union[str, _models.Expand], + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineImage"]: + """list_with_properties. + + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: A valid image publisher. Required. + :type publisher_name: str + :param offer: A valid image publisher offer. Required. + :type offer: str + :param skus: A valid image SKU. Required. + :type skus: str + :keyword expand: The expand expression to apply on the operation. "Properties" Required. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.Expand + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: An iterator like instance of either VirtualMachineImage or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetExtensionListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineImagesWithPropertiesListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11187,10 +10694,15 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_scale_set_extensions_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + _request = build_virtual_machine_images_list_with_properties_request( + location=location, + publisher_name=publisher_name, + offer=offer, + skus=skus, subscription_id=self._config.subscription_id, + expand=expand, + top=top, + orderby=orderby, api_version=api_version, headers=_headers, params=_params, @@ -11215,7 +10727,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) + deserialized = self._deserialize("VirtualMachineImagesWithPropertiesListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -11239,27 +10751,29 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-too-long +class LogAnalyticsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_rolling_upgrades` attribute. + :attr:`log_analytics` attribute. """ models = _models def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: + def _export_request_rate_by_interval_initial( + self, location: str, parameters: Union[_models.RequestRateByIntervalInput, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11268,17 +10782,28 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_rolling_upgrades_cancel_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RequestRateByIntervalInput") + + _request = build_log_analytics_export_request_rate_by_interval_request( + location=location, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -11300,38 +10825,103 @@ def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_cancel(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> LROPoller[None]: - """Cancels the current virtual machine scale set rolling upgrade. + @overload + def begin_export_request_rate_by_interval( + self, + location: str, + parameters: _models.RequestRateByIntervalInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param location: The name of Azure region. Required. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RequestRateByIntervalInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @overload + def begin_export_request_rate_by_interval( + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The name of Azure region. Required. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_export_request_rate_by_interval( + self, location: str, parameters: Union[_models.RequestRateByIntervalInput, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The name of Azure region. Required. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is + either a RequestRateByIntervalInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RequestRateByIntervalInput or + IO[bytes] + :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._cancel_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + raw_result = self._export_request_rate_by_interval_initial( + location=location, + parameters=parameters, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -11340,27 +10930,33 @@ def begin_cancel(self, resource_group_name: str, vm_scale_set_name: str, **kwarg raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LogAnalyticsOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.LogAnalyticsOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _start_os_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + def _export_throttled_requests_initial( + self, location: str, parameters: Union[_models.ThrottledRequestsInput, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11370,17 +10966,28 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ThrottledRequestsInput") + + _request = build_log_analytics_export_throttled_requests_request( + location=location, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -11402,42 +11009,100 @@ def _start_os_upgrade_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_export_throttled_requests( + self, + location: str, + parameters: _models.ThrottledRequestsInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The name of Azure region. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ThrottledRequestsInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export_throttled_requests( + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The name of Azure region. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_start_os_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Starts a rolling upgrade to move all virtual machine scale set instances to the latest - available Platform Image OS version. Instances which are already running the latest available - OS version are not affected. + def begin_export_throttled_requests( + self, location: str, parameters: Union[_models.ThrottledRequestsInput, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.LogAnalyticsOperationResult]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param location: The name of Azure region. Required. + :type location: str + :param parameters: The request body. Is either a ThrottledRequestsInput type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ThrottledRequestsInput or IO[bytes] + :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._start_os_upgrade_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + raw_result = self._export_throttled_requests_initial( + location=location, + parameters=parameters, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -11446,28 +11111,66 @@ def begin_start_os_upgrade( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LogAnalyticsOperationResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.LogAnalyticsOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _start_extension_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> Iterator[bytes]: + +class VirtualMachineExtensionImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`virtual_machine_extension_images` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_types( + self, location: str, publisher_name: str, **kwargs: Any + ) -> List[_models.VirtualMachineExtensionImage]: + """Gets a list of virtual machine extension image types. + + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :return: list of VirtualMachineExtensionImage or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionImage] + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11480,11 +11183,11 @@ def _start_extension_upgrade_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + _request = build_virtual_machine_extension_images_list_types_request( + location=location, + publisher_name=publisher_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -11492,23 +11195,18 @@ def _start_extension_upgrade_initial( ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("[VirtualMachineExtensionImage]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11516,73 +11214,33 @@ def _start_extension_upgrade_initial( return deserialized # type: ignore @distributed_trace - def begin_start_extension_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to - the latest available extension version. Instances which are already running the latest - extension versions are not affected. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_extension_upgrade_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get_latest( - self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any - ) -> _models.RollingUpgradeStatusInfo: - """Gets the status of the latest virtual machine scale set rolling upgrade. + def list_versions( + self, + location: str, + publisher_name: str, + type: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List[_models.VirtualMachineExtensionImage]: + """Gets a list of virtual machine extension image versions. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :return: RollingUpgradeStatusInfo or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RollingUpgradeStatusInfo + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :param type: Required. + :type type: str + :keyword filter: The filter to apply on the operation. Default value is None. + :paramtype filter: str + :keyword top: Default value is None. + :paramtype top: int + :keyword orderby: Default value is None. + :paramtype orderby: str + :return: list of VirtualMachineExtensionImage or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionImage] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11597,12 +11255,16 @@ def get_latest( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RollingUpgradeStatusInfo] = kwargs.pop("cls", None) + cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, + _request = build_virtual_machine_extension_images_list_versions_request( + location=location, + publisher_name=publisher_name, + type=type, subscription_id=self._config.subscription_id, + filter=filter, + top=top, + orderby=orderby, api_version=api_version, headers=_headers, params=_params, @@ -11620,43 +11282,31 @@ def get_latest( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RollingUpgradeStatusInfo", pipeline_response.http_response) + deserialized = self._deserialize("[VirtualMachineExtensionImage]", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @distributed_trace + def get( + self, location: str, publisher_name: str, type: str, version: str, **kwargs: Any + ) -> _models.VirtualMachineExtensionImage: + """Gets a virtual machine extension image. -class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_vm_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - def _create_or_update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + :param location: The name of Azure region. Required. + :type location: str + :param publisher_name: Required. + :type publisher_name: str + :param type: Required. + :type type: str + :param version: Required. + :type version: str + :return: VirtualMachineExtensionImage or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionImage + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11665,218 +11315,154 @@ def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetVMExtension") + cls: ClsType[_models.VirtualMachineExtensionImage] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_extensions_create_or_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, + _request = build_virtual_machine_extension_images_get_request( + location=location, + publisher_name=publisher_name, + type=type, + version=version, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("VirtualMachineExtensionImage", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetVMExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to create or update the VMSS VM extension. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ +class VirtualMachineRunCommandsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to create or update the VMSS VM extension. + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`virtual_machine_run_commands` attribute. + """ - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the - result of cls(response) + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> Iterable["_models.RunCommandDocumentBase"]: + """Lists all available run commands for a subscription in a location. + + :param location: The name of Azure region. Required. + :type location: str + :return: An iterator like instance of either RunCommandDocumentBase or the result of + cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.RunCommandDocumentBase] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to create or update the VMSS VM extension. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.RunCommandListResult] = kwargs.pop("cls", None) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Is either a VirtualMachineScaleSetVMExtension type or a IO[bytes] type. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + def prepare_request(next_link=None): + if not next_link: - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) + _request = build_virtual_machine_run_commands_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RunCommandListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return LROPoller[_models.VirtualMachineScaleSetVMExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + response = pipeline_response.http_response - def _update_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, location: str, command_id: str, **kwargs: Any) -> _models.RunCommandDocument: + """Gets specific run command for a subscription in a location. + + :param location: The name of Azure region. Required. + :type location: str + :param command_id: The command id. Required. + :type command_id: str + :return: RunCommandDocument or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RunCommandDocument + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -11885,38 +11471,23 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetVMExtensionUpdate") + cls: ClsType[_models.RunCommandDocument] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_extensions_update_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, + _request = build_virtual_machine_run_commands_get_request( + location=location, + command_id=command_id, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -11924,174 +11495,41 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200]: - 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("RunCommandDocument", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineScaleSetVMExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to update the VMSS VM extension. + @distributed_trace + def list_by_virtual_machine( + self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.VirtualMachineRunCommand"]: + """The operation to get all run commands of a Virtual Machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the - result of cls(response) + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of either VirtualMachineRunCommand or the result of + cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @overload - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineRunCommandsListResult] = kwargs.pop("cls", None) - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: - """The operation to update the VMSS VM extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Is either a VirtualMachineScaleSetVMExtensionUpdate type or a IO[bytes] type. - Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtensionUpdate or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachineScaleSetVMExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12100,132 +11538,84 @@ def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vm_extensions_delete_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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=_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + def prepare_request(next_link=None): + if not next_link: - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + _request = build_virtual_machine_run_commands_list_by_virtual_machine_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - return deserialized # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - @distributed_trace - def begin_delete( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any - ) -> LROPoller[None]: - """The operation to delete the VMSS VM extension. + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def get_next(next_link=None): + _request = prepare_request(next_link) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + response = pipeline_response.http_response - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace - def get( + def get_by_virtual_machine( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_extension_name: str, + vm_name: str, + run_command_name: str, *, expand: Optional[str] = None, **kwargs: Any - ) -> _models.VirtualMachineScaleSetVMExtension: - """The operation to get the VMSS VM extension. + ) -> _models.VirtualMachineRunCommand: + """The operation to get the run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str :keyword expand: The expand expression to apply on the operation. Default value is None. :paramtype expand: str - :return: VirtualMachineScaleSetVMExtension or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension + :return: VirtualMachineRunCommand or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12240,13 +11630,12 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_extensions_get_request( + _request = build_virtual_machine_run_commands_get_by_virtual_machine_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_extension_name=vm_extension_name, + vm_name=vm_name, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, expand=expand, api_version=api_version, @@ -12266,112 +11655,19 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( + def _create_or_update_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any - ) -> _models.VirtualMachineScaleSetVMExtensionsListResult: - """The operation to get all extensions of an instance in Virtual Machine Scaleset. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineScaleSetVMExtensionsListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtensionsListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMExtensionsListResult] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vm_extensions_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "VirtualMachineScaleSetVMExtensionsListResult", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_vms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - def _reimage_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[ - Union[_models.VirtualMachineScaleSetVMReimageParameters, IO[bytes]] - ] = None, + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -12392,18 +11688,15 @@ def _reimage_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(vm_scale_set_vm_reimage_input, (IOBase, bytes)): - _content = vm_scale_set_vm_reimage_input + if isinstance(run_command, (IOBase, bytes)): + _content = run_command else: - if vm_scale_set_vm_reimage_input is not None: - _json = self._serialize.body(vm_scale_set_vm_reimage_input, "VirtualMachineScaleSetVMReimageParameters") - else: - _json = None + _json = self._serialize.body(run_command, "VirtualMachineRunCommand") - _request = build_virtual_machine_scale_set_vms_reimage_request( + _request = build_virtual_machine_run_commands_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_name=vm_name, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -12422,7 +11715,7 @@ def _reimage_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -12430,100 +11723,109 @@ def _reimage_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_reimage( + def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[_models.VirtualMachineScaleSetVMReimageParameters] = None, + vm_name: str, + run_command_name: str, + run_command: _models.VirtualMachineRunCommand, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. - Default value is None. - :type vm_scale_set_vm_reimage_input: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMReimageParameters + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_reimage( + def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[IO[bytes]] = None, + vm_name: str, + run_command_name: str, + run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[None]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. - Default value is None. - :type vm_scale_set_vm_reimage_input: IO[bytes] + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_reimage( + def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - vm_scale_set_vm_reimage_input: Optional[ - Union[_models.VirtualMachineScaleSetVMReimageParameters, IO[bytes]] - ] = None, + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], **kwargs: Any - ) -> LROPoller[None]: - """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to create or update the run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. - Is either a VirtualMachineScaleSetVMReimageParameters type or a IO[bytes] type. Default value - is None. - :type vm_scale_set_vm_reimage_input: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMReimageParameters or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is + either a VirtualMachineRunCommand type or a IO[bytes] type. Required. + :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand or IO[bytes] + :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -12531,16 +11833,16 @@ def begin_reimage( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._reimage_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -12551,28 +11853,664 @@ def begin_reimage( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineRunCommand].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(run_command, (IOBase, bytes)): + _content = run_command + else: + _json = self._serialize.body(run_command, "VirtualMachineRunCommandUpdate") + + _request = build_virtual_machine_run_commands_update_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: _models.VirtualMachineRunCommandUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + Required. + :type run_command: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineRunCommand]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is + either a VirtualMachineRunCommandUpdate type or a IO[bytes] type. Required. + :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandUpdate or + IO[bytes] + :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.VirtualMachineRunCommand].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualMachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_run_commands_delete_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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=_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + ) -> LROPoller[None]: + """The operation to delete the run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the VirtualMachine. Required. + :type vm_name: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class UsageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`usage` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: + """Gets, for the specified location, the current compute resource usage information as well as the + limits for compute resources under the subscription. + + :param location: The name of Azure region. Required. + :type location: str + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_usage_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListUsagesResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VirtualMachineScaleSetsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`virtual_machine_scale_sets` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.VirtualMachineScaleSet"]: + """Gets all the VM scale sets under the specified subscription for the specified location. + + :param location: The name of Azure region. Required. + :type location: str + :return: An iterator like instance of either VirtualMachineScaleSet or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_all(self, **kwargs: Any) -> Iterable["_models.VirtualMachineScaleSet"]: + """Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource + group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this + till nextLink is null to fetch all the VM Scale Sets. + + :return: An iterator like instance of either VirtualMachineScaleSet or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetListWithLinkResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetListWithLinkResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualMachineScaleSet"]: + """Gets a list of all VM scale sets under a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either VirtualMachineScaleSet or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetListResult] = kwargs.pop("cls", None) - def _reimage_all_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12581,107 +12519,83 @@ def _reimage_all_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + _request = build_virtual_machine_scale_sets_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machine_scale_set_vms_reimage_all_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def begin_reimage_all( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> LROPoller[None]: - """Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. - This operation is only supported for managed disks. + def get( + self, + resource_group_name: str, + vm_scale_set_name: str, + *, + expand: Optional[Union[str, _models.ExpandTypesForGetVMScaleSets]] = None, + **kwargs: Any + ) -> _models.VirtualMachineScaleSet: + """Display information about a virtual machine scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :keyword expand: The expand expression to apply on the operation. 'UserData' retrieves the + UserData property of the VM scale set that was provided by the user during the VM scale set + Create/Update operation. "userData" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForGetVMScaleSets + :return: VirtualMachineScaleSet or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._reimage_all_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _approve_rolling_upgrade_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12694,104 +12608,46 @@ def _approve_rolling_upgrade_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( + _request = build_virtual_machine_scale_sets_get_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_approve_rolling_upgrade( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> LROPoller[None]: - """Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._approve_rolling_upgrade_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _deallocate_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: Union[_models.VirtualMachineScaleSet, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12801,18 +12657,31 @@ def _deallocate_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_deallocate_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualMachineScaleSet") + + _request = build_virtual_machine_scale_sets_create_or_update_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -12826,7 +12695,7 @@ def _deallocate_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -12834,45 +12703,149 @@ def _deallocate_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: _models.VirtualMachineScaleSet, + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineScaleSet]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The scale set object. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: IO[bytes], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineScaleSet]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The scale set object. Required. + :type parameters: IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_deallocate( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> LROPoller[None]: - """Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and - releases the compute resources it uses. You are not billed for the compute resources of this - virtual machine once it is deallocated. + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: Union[_models.VirtualMachineScaleSet, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineScaleSet]: + """Create or update a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param parameters: The scale set object. Is either a VirtualMachineScaleSet type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet or IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._deallocate_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -12881,31 +12854,36 @@ def begin_deallocate( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineScaleSet].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineScaleSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.VirtualMachineScaleSetVM, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSetUpdate, IO[bytes]], *, if_match: Optional[str] = None, if_none_match: Optional[str] = None, @@ -12932,12 +12910,11 @@ def _update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "VirtualMachineScaleSetVM") + _json = self._serialize.body(parameters, "VirtualMachineScaleSetUpdate") - _request = build_virtual_machine_scale_set_vms_update_request( + _request = build_virtual_machine_scale_sets_update_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, if_match=if_match, if_none_match=if_none_match, @@ -12958,7 +12935,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -12966,10 +12943,14 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -12978,26 +12959,22 @@ def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: _models.VirtualMachineScaleSetVM, + parameters: _models.VirtualMachineScaleSetUpdate, *, if_match: Optional[str] = None, if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVM]: - """Updates a virtual machine of a VM scale set. + ) -> LROPoller[_models.VirtualMachineScaleSet]: + """Update a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be create or - updated. Required. + :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM + :param parameters: The scale set object. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetUpdate :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is None. @@ -13009,10 +12986,10 @@ 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 - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of + :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -13021,25 +12998,21 @@ def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, parameters: IO[bytes], *, if_match: Optional[str] = None, if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVM]: - """Updates a virtual machine of a VM scale set. + ) -> LROPoller[_models.VirtualMachineScaleSet]: + """Update a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be create or - updated. Required. + :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Required. + :param parameters: The scale set object. Required. :type parameters: IO[bytes] :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting @@ -13052,10 +13025,10 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of + :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -13064,25 +13037,23 @@ def begin_update( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.VirtualMachineScaleSetVM, IO[bytes]], + parameters: Union[_models.VirtualMachineScaleSetUpdate, IO[bytes]], *, if_match: Optional[str] = None, if_none_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[_models.VirtualMachineScaleSetVM]: - """Updates a virtual machine of a VM scale set. + ) -> LROPoller[_models.VirtualMachineScaleSet]: + """Update a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set where the extension should be create or - updated. Required. + :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. - Is either a VirtualMachineScaleSetVM type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM or IO[bytes] + :param parameters: The scale set object. Is either a VirtualMachineScaleSetUpdate type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetUpdate or + IO[bytes] :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is None. @@ -13091,10 +13062,10 @@ def begin_update( updating an existing record set. Other values will result in error from server as they are not supported. Default value is None. :paramtype if_none_match: str - :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of + :return: An instance of LROPoller that returns either VirtualMachineScaleSet or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -13102,7 +13073,7 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSet] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -13110,7 +13081,6 @@ def begin_update( raw_result = self._update_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, parameters=parameters, if_match=if_match, if_none_match=if_none_match, @@ -13125,36 +13095,37 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetVM", pipeline_response.http_response) + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("VirtualMachineScaleSet", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachineScaleSetVM].from_continuation_token( + return LROPoller[_models.VirtualMachineScaleSet].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachineScaleSetVM]( + return LROPoller[_models.VirtualMachineScaleSet]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) def _delete_initial( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - *, - force_deletion: Optional[bool] = None, - **kwargs: Any + self, resource_group_name: str, vm_scale_set_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13170,10 +13141,9 @@ def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_delete_request( + _request = build_virtual_machine_scale_sets_delete_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, force_deletion=force_deletion, api_version=api_version, @@ -13198,33 +13168,31 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace def begin_delete( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - *, - force_deletion: Optional[bool] = None, - **kwargs: Any + self, resource_group_name: str, vm_scale_set_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any ) -> LROPoller[None]: - """Deletes a virtual machine from a VM scale set. + """Deletes a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword force_deletion: Optional parameter to force delete a virtual machine from a VM scale - set. (Feature in Preview). Default value is None. + :keyword force_deletion: Optional parameter to force delete a VM scale set. (Feature in + Preview). Default value is None. :paramtype force_deletion: bool :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] @@ -13242,7 +13210,6 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, force_deletion=force_deletion, api_version=api_version, cls=lambda x, y, z: x, @@ -13258,7 +13225,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -13272,248 +13241,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def get( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any - ) -> _models.VirtualMachineScaleSetVM: - """Gets a virtual machine from a VM scale set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve - the instance view of the virtual machine. 'UserData' will retrieve the UserData of the virtual - machine. 'resiliencyView' will retrieve the instance view of the Virtual machine (if - applicable) and include 'resilientVMDeletionStatus' as part of it. Known values are: - "instanceView", "userData", and "resiliencyView". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes - :return: VirtualMachineScaleSetVM or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vms_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetVM", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_instance_view( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> _models.VirtualMachineScaleSetVMInstanceView: - """Gets the status of a virtual machine from a VM scale set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: VirtualMachineScaleSetVMInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceView - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMInstanceView] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vms_get_instance_view_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineScaleSetVMInstanceView", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - virtual_machine_scale_set_name: str, - *, - filter: Optional[str] = None, - select: Optional[str] = None, - expand: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.VirtualMachineScaleSetVM"]: - """Gets a list of all virtual machines in a VM scale sets. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_scale_set_name: The name of the VM scale set. Required. - :type virtual_machine_scale_set_name: str - :keyword filter: The filter to apply to the operation. Allowed values are - 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied - eq true', 'properties/latestModelApplied eq false'. Default value is None. - :paramtype filter: str - :keyword select: The list parameters. Allowed values are 'instanceView', - 'instanceView/statuses'. Default value is None. - :paramtype select: str - :keyword expand: The expand expression to apply to the operation. Allowed values are - 'instanceView'. Default value is None. - :paramtype expand: str - :return: An iterator like instance of either VirtualMachineScaleSetVM or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineScaleSetVMListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machine_scale_set_vms_list_request( - resource_group_name=resource_group_name, - virtual_machine_scale_set_name=virtual_machine_scale_set_name, - subscription_id=self._config.subscription_id, - filter=filter, - select=select, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _power_off_initial( + def _approve_rolling_upgrade_initial( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - *, - skip_shutdown: bool = False, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -13524,19 +13256,32 @@ def _power_off_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_power_off_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None + + _request = build_virtual_machine_scale_sets_approve_rolling_upgrade_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -13550,7 +13295,7 @@ def _power_off_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -13558,57 +13303,116 @@ def _power_off_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_power_off( + @overload + def begin_approve_rolling_upgrade( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, *, - skip_shutdown: bool = False, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached - and you are getting charged for the resources. Instead, use deallocate to release resources and - avoid charges. Additionally, this operation is not allowed on a virtual machine that is being - deallocated or already has been deallocated. + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this - flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. Default value is False. - :paramtype skip_shutdown: bool + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @overload + def begin_approve_rolling_upgrade( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_approve_rolling_upgrade( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Approve upgrade on deferred rolling upgrades for OS disks in the virtual machines in a VM scale + set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._power_off_initial( + raw_result = self._approve_rolling_upgrade_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - skip_shutdown=skip_shutdown, + vm_instance_i_ds=vm_instance_i_ds, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -13621,23 +13425,160 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- if cls: return cls(pipeline_response, None, {}) # type: ignore - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @overload + def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: _models.VMScaleSetConvertToSinglePlacementGroupInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. + :type parameters: + ~azure.mgmt.compute.v2024_11_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The input object for ConvertToSinglePlacementGroup API. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: Union[_models.VMScaleSetConvertToSinglePlacementGroupInput, IO[bytes]], + **kwargs: Any + ) -> None: + """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The input object for ConvertToSinglePlacementGroup API. Is either a + VMScaleSetConvertToSinglePlacementGroupInput type or a IO[bytes] type. Required. + :type parameters: + ~azure.mgmt.compute.v2024_11_01.models.VMScaleSetConvertToSinglePlacementGroupInput or + IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VMScaleSetConvertToSinglePlacementGroupInput") + + _request = build_virtual_machine_scale_sets_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore - def _restart_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + def _deallocate_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + *, + hibernate: Optional[bool] = None, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13647,18 +13588,33 @@ def _restart_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_restart_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None + + _request = build_virtual_machine_scale_sets_deallocate_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, + hibernate=hibernate, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -13680,43 +13636,137 @@ def _restart_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + hibernate: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and + releases the compute resources. You are not billed for the compute resources that this virtual + machine scale set deallocates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + hibernate: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and + releases the compute resources. You are not billed for the compute resources that this virtual + machine scale set deallocates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_restart( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + *, + hibernate: Optional[bool] = None, + **kwargs: Any ) -> LROPoller[None]: - """Restarts a virtual machine in a VM scale set. + """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and + releases the compute resources. You are not billed for the compute resources that this virtual + machine scale set deallocates. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :keyword hibernate: Optional parameter to hibernate a virtual machine from the VM scale set. + (This feature is available for VMSS with Flexible OrchestrationMode only). Default value is + None. + :paramtype hibernate: bool :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restart_initial( + raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_instance_i_ds=vm_instance_i_ds, + hibernate=hibernate, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -13730,7 +13780,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -13744,8 +13796,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _start_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + def _delete_instances_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13755,18 +13813,30 @@ def _start_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_start_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceRequiredIDs") + + _request = build_virtual_machine_scale_sets_delete_instances_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, + force_deletion=force_deletion, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -13788,43 +13858,128 @@ def _start_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + *, + force_deletion: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: IO[bytes], + *, + force_deletion: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: IO[bytes] + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_start( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> LROPoller[None]: - """Starts a virtual machine in a VM scale set. + """Deletes virtual machines in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceRequiredIDs type or a IO[bytes] type. Required. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs or IO[bytes] + :keyword force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._start_initial( + raw_result = self._delete_instances_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_instance_i_ds=vm_instance_i_ds, + force_deletion=force_deletion, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -13838,7 +13993,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -13852,9 +14009,38 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _redeploy_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> Iterator[bytes]: + @distributed_trace + def force_recovery_service_fabric_platform_update_domain_walk( # pylint: disable=name-too-long + self, + resource_group_name: str, + vm_scale_set_name: str, + *, + platform_update_domain: int, + zone: Optional[str] = None, + placement_group_id: Optional[str] = None, + **kwargs: Any + ) -> _models.RecoveryWalkResponse: + """Manual platform update domain walk to update virtual machines in a service fabric virtual + machine scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :keyword platform_update_domain: The platform update domain for which a manual recovery walk is + requested. Required. + :paramtype platform_update_domain: int + :keyword zone: The zone in which the manual recovery walk is requested for cross zone virtual + machine scale set. Default value is None. + :paramtype zone: str + :keyword placement_group_id: The placement group id for which the manual recovery walk is + requested. Default value is None. + :paramtype placement_group_id: str + :return: RecoveryWalkResponse or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RecoveryWalkResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13867,36 +14053,33 @@ def _redeploy_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.RecoveryWalkResponse] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_redeploy_request( + _request = build_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, + platform_update_domain=platform_update_domain, + zone=zone, + placement_group_id=placement_group_id, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("RecoveryWalkResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13904,88 +14087,18 @@ def _redeploy_initial( return deserialized # type: ignore @distributed_trace - def begin_redeploy( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> LROPoller[None]: - """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and - powers it back on. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._redeploy_initial( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def retrieve_boot_diagnostics_data( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - *, - sas_uri_expiration_time_in_minutes: Optional[int] = None, - **kwargs: Any - ) -> _models.RetrieveBootDiagnosticsDataResult: - """The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale - set. + def get_instance_view( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> _models.VirtualMachineScaleSetInstanceView: + """Gets the status of a VM scale set instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs - with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated - with a default expiration duration of 120 minutes. Default value is None. - :paramtype sas_uri_expiration_time_in_minutes: int - :return: RetrieveBootDiagnosticsDataResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RetrieveBootDiagnosticsDataResult + :return: VirtualMachineScaleSetInstanceView or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetInstanceView :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14000,14 +14113,12 @@ def retrieve_boot_diagnostics_data( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetInstanceView] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( + _request = build_virtual_machine_scale_sets_get_instance_view_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, - sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, api_version=api_version, headers=_headers, params=_params, @@ -14025,15 +14136,19 @@ def retrieve_boot_diagnostics_data( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RetrieveBootDiagnosticsDataResult", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineScaleSetInstanceView", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _perform_maintenance_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + def _update_instances_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14043,18 +14158,29 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vms_perform_maintenance_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceRequiredIDs") + + _request = build_virtual_machine_scale_sets_update_instances_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -14076,43 +14202,114 @@ def _perform_maintenance_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_update_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: _models.VirtualMachineScaleSetVMInstanceRequiredIDs, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + Required. + :type vm_instance_i_ds: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_perform_maintenance( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + def begin_update_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Union[_models.VirtualMachineScaleSetVMInstanceRequiredIDs, IO[bytes]], + **kwargs: Any ) -> LROPoller[None]: - """Performs maintenance on a virtual machine in a VM scale set. + """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceRequiredIDs type or a IO[bytes] type. Required. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._perform_maintenance_initial( + raw_result = self._update_instances_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, + vm_instance_i_ds=vm_instance_i_ds, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -14126,7 +14323,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -14141,21 +14340,28 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def simulate_eviction( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any - ) -> None: - """The operation to simulate the eviction of spot virtual machine in a VM scale set. + def get_os_upgrade_history( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> Iterable["_models.UpgradeOperationHistoricalStatusInfo"]: + """Gets list of OS upgrades on a VM scale set instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :return: None or the result of cls(response) - :rtype: None + :return: An iterator like instance of either UpgradeOperationHistoricalStatusInfo or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.UpgradeOperationHistoricalStatusInfo] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetListOSUpgradeHistory] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14164,43 +14370,65 @@ def simulate_eviction( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + _request = build_virtual_machine_scale_sets_get_os_upgrade_history_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machine_scale_set_vms_simulate_eviction_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetListOSUpgradeHistory", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - def _attach_detach_data_disks_initial( + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _perform_maintenance_initial( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -14221,15 +14449,17 @@ def _attach_detach_data_disks_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _json = self._serialize.body(parameters, "AttachDetachDataDisksRequest") + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None - _request = build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( + _request = build_virtual_machine_scale_sets_perform_maintenance_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -14259,6 +14489,7 @@ def _attach_detach_data_disks_initial( response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -14268,92 +14499,92 @@ def _attach_detach_data_disks_initial( return deserialized # type: ignore @overload - def begin_attach_detach_data_disks( + def begin_perform_maintenance( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: _models.AttachDetachDataDisksRequest, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. + ) -> LROPoller[None]: + """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances + which are not eligible for perform maintenance will be failed. Please refer to best practices + for more details: + https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_attach_detach_data_disks( + def begin_perform_maintenance( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: IO[bytes], + vm_instance_i_ds: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. + ) -> LROPoller[None]: + """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances + which are not eligible for perform maintenance will be failed. Please refer to best practices + for more details: + https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Required. - :type parameters: IO[bytes] + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_attach_detach_data_disks( + def begin_perform_maintenance( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from a virtual machine in a VM scale set. + ) -> LROPoller[None]: + """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances + which are not eligible for perform maintenance will be failed. Please refer to best practices + for more details: + https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the attach and detach data disks operation on a - Virtual Machine Scale Sets VM. Is either a AttachDetachDataDisksRequest type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest or - IO[bytes] - :return: An instance of LROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -14361,16 +14592,15 @@ def begin_attach_detach_data_disks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._attach_detach_data_disks_initial( + raw_result = self._perform_maintenance_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - parameters=parameters, + vm_instance_i_ds=vm_instance_i_ds, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -14381,11 +14611,9 @@ def begin_attach_detach_data_disks( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageProfile", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -14396,22 +14624,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.StorageProfile].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.StorageProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _run_command_initial( + def _power_off_initial( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + *, + skip_shutdown: Optional[bool] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -14431,17 +14658,20 @@ def _run_command_initial( content_type = content_type or "application/json" _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _json = self._serialize.body(parameters, "RunCommandInput") + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None - _request = build_virtual_machine_scale_set_vms_run_command_request( + _request = build_virtual_machine_scale_sets_power_off_request( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, api_version=api_version, content_type=content_type, json=_json, @@ -14467,96 +14697,118 @@ def _run_command_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_run_command( + def begin_power_off( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: _models.RunCommandInput, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, *, + skip_shutdown: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. + ) -> LROPoller[None]: + """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still + attached and you are getting charged for the resources. Instead, use deallocate to release + resources and avoid charges. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. Default value is None. + :paramtype skip_shutdown: bool :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_run_command( + def begin_power_off( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: IO[bytes], + vm_instance_i_ds: Optional[IO[bytes]] = None, *, + skip_shutdown: Optional[bool] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. + ) -> LROPoller[None]: + """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still + attached and you are getting charged for the resources. Instead, use deallocate to release + resources and avoid charges. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: IO[bytes] + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] + :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. Default value is None. + :paramtype skip_shutdown: bool :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is "application/json". + Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_run_command( + def begin_power_off( self, resource_group_name: str, vm_scale_set_name: str, - instance_id: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + *, + skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on a virtual machine in a VM scale set. + ) -> LROPoller[None]: + """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still + attached and you are getting charged for the resources. Instead, use deallocate to release + resources and avoid charges. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_scale_set_name: The name of the VM scale set. Required. :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param parameters: Parameters supplied to the Run command operation. Is either a - RunCommandInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput or IO[bytes] - :return: An instance of LROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. Default value is None. + :paramtype skip_shutdown: bool + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -14564,16 +14816,16 @@ def begin_run_command( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._power_off_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - parameters=parameters, + vm_instance_i_ds=vm_instance_i_ds, + skip_shutdown=skip_shutdown, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -14584,11 +14836,9 @@ def begin_run_command( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RunCommandResult", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -14599,45 +14849,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.RunCommandResult].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.RunCommandResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - -class VirtualMachineExtensionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machine_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _create_or_update_initial( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtension, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + def _reapply_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14646,30 +14866,17 @@ def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "VirtualMachineExtension") - - _request = build_virtual_machine_extensions_create_or_update_request( + _request = build_virtual_machine_scale_sets_reapply_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -14683,7 +14890,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -14691,124 +14898,45 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be created or - updated. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be created or - updated. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtension, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be created or - updated. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension - operation. Is either a VirtualMachineExtension type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension or - IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] + def begin_reapply(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> LROPoller[None]: + """Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine + Instances. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._reapply_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - extension_parameters=extension_parameters, + vm_scale_set_name=vm_scale_set_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -14817,35 +14945,32 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachineExtension].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachineExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _update_initial( + def _redeploy_initial( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtensionUpdate, IO[bytes]], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -14866,15 +14991,17 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(extension_parameters, (IOBase, bytes)): - _content = extension_parameters + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _json = self._serialize.body(extension_parameters, "VirtualMachineExtensionUpdate") + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None - _request = build_virtual_machine_extensions_update_request( + _request = build_virtual_machine_scale_sets_redeploy_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -14893,7 +15020,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -14901,106 +15028,99 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_update( + def begin_redeploy( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: _models.VirtualMachineExtensionUpdate, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineExtension]: - """The operation to update the extension. + ) -> LROPoller[None]: + """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, + and powers them back on. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be updated. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionUpdate + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_redeploy( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: IO[bytes], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineExtension]: - """The operation to update the extension. + ) -> LROPoller[None]: + """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, + and powers them back on. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be updated. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Required. - :type extension_parameters: IO[bytes] + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def begin_redeploy( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - extension_parameters: Union[_models.VirtualMachineExtensionUpdate, IO[bytes]], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any - ) -> LROPoller[_models.VirtualMachineExtension]: - """The operation to update the extension. + ) -> LROPoller[None]: + """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, + and powers them back on. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be updated. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension - operation. Is either a VirtualMachineExtensionUpdate type or a IO[bytes] type. Required. - :type extension_parameters: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionUpdate or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -15008,16 +15128,15 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._redeploy_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - extension_parameters=extension_parameters, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -15028,31 +15147,33 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachineExtension].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachineExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_initial( - self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any + def _reimage_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[Union[_models.VirtualMachineScaleSetReimageParameters, IO[bytes]]] = None, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15062,18 +15183,32 @@ def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_extensions_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vm_scale_set_reimage_input, (IOBase, bytes)): + _content = vm_scale_set_reimage_input + else: + if vm_scale_set_reimage_input is not None: + _json = self._serialize.body(vm_scale_set_reimage_input, "VirtualMachineScaleSetReimageParameters") + else: + _json = None + + _request = build_virtual_machine_scale_sets_reimage_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -15087,7 +15222,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -15095,44 +15230,118 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[_models.VirtualMachineScaleSetReimageParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which + don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual + machine is reset to initial state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetReimageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which + don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual + machine is reset to initial state. - return deserialized # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. + :type vm_scale_set_reimage_input: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_delete( - self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional[Union[_models.VirtualMachineScaleSetReimageParameters, IO[bytes]]] = None, + **kwargs: Any ) -> LROPoller[None]: - """The operation to delete the extension. + """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which + don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual + machine is reset to initial state. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the extension should be deleted. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Is either a + VirtualMachineScaleSetReimageParameters type or a IO[bytes] type. Default value is None. + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetReimageParameters or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._reimage_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + vm_scale_set_name=vm_scale_set_name, + vm_scale_set_reimage_input=vm_scale_set_reimage_input, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -15146,7 +15355,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -15160,30 +15371,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def get( + def _reimage_all_initial( self, resource_group_name: str, - vm_name: str, - vm_extension_name: str, - *, - expand: Optional[str] = None, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any - ) -> _models.VirtualMachineExtension: - """The operation to get the extension. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine containing the extension. Required. - :type vm_name: str - :param vm_extension_name: The name of the virtual machine extension. Required. - :type vm_extension_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineExtension or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15192,205 +15386,198 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_extensions_get_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds + else: + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None + + _request = build_virtual_machine_scale_sets_reimage_all_request( resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( - self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any - ) -> _models.VirtualMachineExtensionsListResult: - """The operation to get all extensions of a Virtual Machine. + @overload + def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This + operation is only supported for managed disks. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine containing the extension. Required. - :type vm_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineExtensionsListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionsListResult + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineExtensionsListResult] = kwargs.pop("cls", None) - - _request = build_virtual_machine_extensions_list_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineExtensionsListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - -class VirtualMachinesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machines` attribute. - """ - - models = _models + @overload + def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This + operation is only supported for managed disks. - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.VirtualMachine"]: - """Gets all the virtual machines under the specified subscription for the specified location. + def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This + operation is only supported for managed disks. - :param location: The location for which virtual machines under the subscription are queried. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machines_list_by_location_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) - list_of_elem = deserialized.value + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) + return cls(pipeline_response, None, {}) # type: ignore - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _capture_initial( + def _restart_initial( self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineCaptureParameters, IO[bytes]], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -15411,14 +15598,17 @@ def _capture_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _json = self._serialize.body(parameters, "VirtualMachineCaptureParameters") + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None - _request = build_virtual_machines_capture_request( + _request = build_virtual_machine_scale_sets_restart_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -15445,94 +15635,96 @@ def _capture_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_capture( + def begin_restart( self, resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachineCaptureParameters, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineCaptureResult]: - """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used - to create similar VMs. + ) -> LROPoller[None]: + """Restarts one or more virtual machines in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureParameters + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureResult] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_capture( + def begin_restart( self, resource_group_name: str, - vm_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineCaptureResult]: - """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used - to create similar VMs. + ) -> LROPoller[None]: + """Restarts one or more virtual machines in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. - :type parameters: IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureResult] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_capture( + def begin_restart( self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineCaptureParameters, IO[bytes]], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any - ) -> LROPoller[_models.VirtualMachineCaptureResult]: - """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used - to create similar VMs. + ) -> LROPoller[None]: + """Restarts one or more virtual machines in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Capture Virtual Machine operation. Is either a - VirtualMachineCaptureParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureParameters or - IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureResult] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -15540,15 +15732,15 @@ def begin_capture( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineCaptureResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._capture_initial( + raw_result = self._restart_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -15559,11 +15751,9 @@ def begin_capture( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineCaptureResult", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -15574,24 +15764,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachineCaptureResult].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachineCaptureResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _create_or_update_initial( + def _set_orchestration_service_state_initial( self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachine, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + vm_scale_set_name: str, + parameters: Union[_models.OrchestrationServiceStateInput, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -15615,14 +15800,12 @@ def _create_or_update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "VirtualMachine") + _json = self._serialize.body(parameters, "OrchestrationServiceStateInput") - _request = build_virtual_machines_create_or_update_request( + _request = build_virtual_machine_scale_sets_set_orchestration_service_state_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, api_version=api_version, content_type=content_type, json=_json, @@ -15640,7 +15823,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -15648,121 +15831,93 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_set_orchestration_service_state( self, resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachine, + vm_scale_set_name: str, + parameters: _models.OrchestrationServiceStateInput, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """The operation to create or update a virtual machine. Please note some properties can be set - only during virtual machine creation. + ) -> LROPoller[None]: + """Changes ServiceState property for a given service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachine - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The input object for SetOrchestrationServiceState API. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.OrchestrationServiceStateInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_set_orchestration_service_state( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, parameters: IO[bytes], *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """The operation to create or update a virtual machine. Please note some properties can be set - only during virtual machine creation. + ) -> LROPoller[None]: + """Changes ServiceState property for a given service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The input object for SetOrchestrationServiceState API. Required. :type parameters: IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def begin_set_orchestration_service_state( self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachine, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + vm_scale_set_name: str, + parameters: Union[_models.OrchestrationServiceStateInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """The operation to create or update a virtual machine. Please note some properties can be set - only during virtual machine creation. + ) -> LROPoller[None]: + """Changes ServiceState property for a given service. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Create Virtual Machine operation. Is either a - VirtualMachine type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachine or IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param parameters: The input object for SetOrchestrationServiceState API. Is either a + OrchestrationServiceStateInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.OrchestrationServiceStateInput or + IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -15770,17 +15925,15 @@ def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._set_orchestration_service_state_initial( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -15791,37 +15944,118 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachine].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _update_initial( + @distributed_trace + def list_skus( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetSku"]: + """Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM + instances allowed for each SKU. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An iterator like instance of either VirtualMachineScaleSetSku or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetListSkusResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machine_scale_sets_list_skus_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetListSkusResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _start_initial( self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineUpdate, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -15842,17 +16076,18 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(vm_instance_i_ds, (IOBase, bytes)): + _content = vm_instance_i_ds else: - _json = self._serialize.body(parameters, "VirtualMachineUpdate") + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, "VirtualMachineScaleSetVMInstanceIDs") + else: + _json = None - _request = build_virtual_machines_update_request( + _request = build_virtual_machine_scale_sets_start_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, api_version=api_version, content_type=content_type, json=_json, @@ -15870,7 +16105,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -15878,118 +16113,96 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_update( + def begin_start( self, resource_group_name: str, - vm_name: str, - parameters: _models.VirtualMachineUpdate, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[_models.VirtualMachineScaleSetVMInstanceIDs] = None, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """The operation to update a virtual machine. + ) -> LROPoller[None]: + """Starts one or more virtual machines in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineUpdate - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_start( self, resource_group_name: str, - vm_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + vm_instance_i_ds: Optional[IO[bytes]] = None, *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """The operation to update a virtual machine. + ) -> LROPoller[None]: + """Starts one or more virtual machines in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. - :type parameters: IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def begin_start( self, resource_group_name: str, - vm_name: str, - parameters: Union[_models.VirtualMachineUpdate, IO[bytes]], - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, + vm_scale_set_name: str, + vm_instance_i_ds: Optional[Union[_models.VirtualMachineScaleSetVMInstanceIDs, IO[bytes]]] = None, **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """The operation to update a virtual machine. + ) -> LROPoller[None]: + """Starts one or more virtual machines in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Update Virtual Machine operation. Is either a - VirtualMachineUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineUpdate or IO[bytes] - :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the - current resource. Specify the last-seen ETag value to prevent accidentally overwriting - concurrent changes. Default value is None. - :paramtype if_match: str - :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will result in error from server as they are not - supported. Default value is None. - :paramtype if_none_match: str - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Is + either a VirtualMachineScaleSetVMInstanceIDs type or a IO[bytes] type. Default value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceIDs or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -15997,17 +16210,15 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._start_initial( resource_group_name=resource_group_name, - vm_name=vm_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -16018,32 +16229,159 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class VirtualMachinesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`virtual_machines` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.VirtualMachine"]: + """Gets all the virtual machines under the specified subscription for the specified location. + + :param location: The name of Azure region. Required. + :type location: str + :return: An iterator like instance of either VirtualMachine or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_all( + self, + *, + status_only: Optional[str] = None, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, + **kwargs: Any + ) -> Iterable["_models.VirtualMachine"]: + """Lists all of the virtual machines in the specified subscription. Use the nextLink property in + the response to get the next page of virtual machines. + + :keyword status_only: statusOnly=true enables fetching run time status of all Virtual Machines + in the subscription. Default value is None. + :paramtype status_only: str + :keyword filter: The system query option to filter VMs returned in the response. Allowed value + is 'virtualMachineScaleSet/id' eq + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + Default value is None. + :paramtype filter: str + :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching + run time status of all Virtual Machines, this can only be specified if a valid $filter option + is specified. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForListVMs + :return: An iterator like instance of either VirtualMachine or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.VirtualMachine].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.VirtualMachine]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - def _delete_initial( - self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16052,135 +16390,95 @@ def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + _request = build_virtual_machines_list_all_request( + subscription_id=self._config.subscription_id, + status_only=status_only, + filter=filter, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machines_delete_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - force_deletion=force_deletion, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def begin_delete( - self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any - ) -> LROPoller[None]: - """The operation to delete a virtual machine. + def list( + self, + resource_group_name: str, + *, + filter: Optional[str] = None, + expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, + **kwargs: Any + ) -> Iterable["_models.VirtualMachine"]: + """Lists all of the virtual machines in the specified resource group. Use the nextLink property in + the response to get the next page of virtual machines. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword force_deletion: Optional parameter to force delete virtual machines. - NOTE: As of api-version 2024-11-01, we are rolling out a feature where if the forceDeletion - parameter is unspecified OR not explicitly set to false, AND all of the VM's attached disks - including the OS disk are marked with the delete option, then the VM will be force deleted. For - more details on how to configure delete options for a VM's resources, see `Delete a VM and - attached resources `_. To - avoid defaulting to force delete, ensure that the forceDeletion parameter is explicitly set to - false. This feature is expected to rollout by end of March 2025. Default value is None. - :paramtype force_deletion: bool - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :keyword filter: The system query option to filter VMs returned in the response. Allowed value + is 'virtualMachineScaleSet/id' eq + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + Default value is None. + :paramtype filter: str + :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching + run time status of all Virtual Machines, this can only be specified if a valid $filter option + is specified. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.ExpandTypeForListVMs + :return: An iterator like instance of either VirtualMachine or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - force_deletion=force_deletion, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - vm_name: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any - ) -> _models.VirtualMachine: - """Retrieves information about the model view or the instance view of a virtual machine. + cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves a - snapshot of the runtime properties of the virtual machine that is managed by the platform and - can change outside of control plane operations. 'UserData' retrieves the UserData property as - part of the VM model view that was provided by the user during the VM Create/Update operation. - Known values are: "instanceView", "userData", and "resiliencyView". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes - :return: VirtualMachine or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachine - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16189,53 +16487,85 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + _request = build_virtual_machines_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machines_get_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def instance_view( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> _models.VirtualMachineInstanceView: - """Retrieves information about the run-time state of a virtual machine. + def get( + self, + resource_group_name: str, + vm_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.VirtualMachine: + """Retrieves information about the model view or the instance view of a virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: VirtualMachineInstanceView or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstanceView + :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves a + snapshot of the runtime properties of the virtual machine that is managed by the platform and + can change outside of control plane operations. 'UserData' retrieves the UserData property as + part of the VM model view that was provided by the user during the VM Create/Update operation. + Known values are: "instanceView", "userData", and "resiliencyView". Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes + :return: VirtualMachine or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachine :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -16250,12 +16580,13 @@ def instance_view( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineInstanceView] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - _request = build_virtual_machines_instance_view_request( + _request = build_virtual_machines_get_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -16273,15 +16604,22 @@ def instance_view( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineInstanceView", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _convert_to_managed_disks_initial( - self, resource_group_name: str, vm_name: str, **kwargs: Any + def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachine, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16291,17 +16629,31 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_convert_to_managed_disks_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualMachine") + + _request = build_virtual_machines_create_or_update_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -16315,7 +16667,7 @@ def _convert_to_managed_disks_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -16323,148 +16675,149 @@ def _convert_to_managed_disks_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_convert_to_managed_disks(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]: - """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be - stop-deallocated before invoking this operation. + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + parameters: _models.VirtualMachine, + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """The operation to create or update a virtual machine. Please note some properties can be set + only during virtual machine creation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachine + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachine or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._convert_to_managed_disks_initial( - resource_group_name=resource_group_name, - vm_name=vm_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _deallocate_initial( - self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_virtual_machines_deallocate_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - hibernate=hibernate, - api_version=api_version, - headers=_headers, - params=_params, - ) - _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=_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + parameters: IO[bytes], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """The operation to create or update a virtual machine. Please note some properties can be set + only during virtual machine creation. - return deserialized # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. Required. + :type parameters: IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachine or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_deallocate( - self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any - ) -> LROPoller[None]: - """Shuts down the virtual machine and releases the compute resources. You are not billed for the - compute resources that this virtual machine uses. + def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachine, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """The operation to create or update a virtual machine. Please note some properties can be set + only during virtual machine creation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :keyword hibernate: Optional parameter to hibernate a virtual machine. Default value is None. - :paramtype hibernate: bool - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param parameters: Parameters supplied to the Create Virtual Machine operation. Is either a + VirtualMachine type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachine or IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :return: An instance of LROPoller that returns either VirtualMachine or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._deallocate_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, vm_name=vm_name, - hibernate=hibernate, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -16473,44 +16826,41 @@ def begin_deallocate( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachine].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def generalize( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> None: - """Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the - virtual machine before performing this operation. For Windows, please refer to `Create a - managed image of a generalized VM in Azure - `_. For - Linux, please refer to `How to create an image of a virtual machine or VHD - `_. + return LROPoller[_models.VirtualMachine]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _update_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachineUpdate, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16519,23 +16869,38 @@ def generalize( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_generalize_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualMachineUpdate") + + _request = build_virtual_machines_update_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -16543,292 +16908,192 @@ def generalize( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - *, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypeForListVMs]] = None, - **kwargs: Any - ) -> Iterable["_models.VirtualMachine"]: - # pylint: disable=line-too-long - """Lists all of the virtual machines in the specified resource group. Use the nextLink property in - the response to get the next page of virtual machines. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :keyword filter: The system query option to filter VMs returned in the response. Allowed value - is 'virtualMachineScaleSet/id' eq - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. - Default value is None. - :paramtype filter: str - :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching - run time status of all Virtual Machines, this can only be specified if a valid $filter option - is specified. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.ExpandTypeForListVMs - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machines_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_all( - self, - *, - status_only: Optional[str] = None, - filter: Optional[str] = None, - expand: Optional[Union[str, _models.ExpandTypesForListVMs]] = None, - **kwargs: Any - ) -> Iterable["_models.VirtualMachine"]: - # pylint: disable=line-too-long - """Lists all of the virtual machines in the specified subscription. Use the nextLink property in - the response to get the next page of virtual machines. - - :keyword status_only: statusOnly=true enables fetching run time status of all Virtual Machines - in the subscription. Default value is None. - :paramtype status_only: str - :keyword filter: The system query option to filter VMs returned in the response. Allowed value - is 'virtualMachineScaleSet/id' eq - /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. - Default value is None. - :paramtype filter: str - :keyword expand: The expand expression to apply on operation. 'instanceView' enables fetching - run time status of all Virtual Machines, this can only be specified if a valid $filter option - is specified. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForListVMs - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machines_list_all_request( - subscription_id=self._config.subscription_id, - status_only=status_only, - filter=filter, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - def get_next(next_link=None): - _request = prepare_request(next_link) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + return deserialized # type: ignore - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + parameters: _models.VirtualMachineUpdate, + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. - return pipeline_response + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineUpdate + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachine or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ - return ItemPaged(get_next, extract_data) + @overload + def begin_update( + self, + resource_group_name: str, + vm_name: str, + parameters: IO[bytes], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. Required. + :type parameters: IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachine or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list_available_sizes( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> Iterable["_models.VirtualMachineSize"]: - """Lists all available virtual machine sizes to which the specified virtual machine can be - resized. + def begin_update( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachineUpdate, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.VirtualMachine]: + """The operation to update a virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] + :param parameters: Parameters supplied to the Update Virtual Machine operation. Is either a + VirtualMachineUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineUpdate or IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :return: An instance of LROPoller that returns either VirtualMachine or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachine] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machines_list_available_sizes_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = self._deserialize("VirtualMachine", pipeline_response.http_response) if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.VirtualMachine].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualMachine]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _power_off_initial( - self, resource_group_name: str, vm_name: str, *, skip_shutdown: bool = False, **kwargs: Any + def _delete_initial( + self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16844,11 +17109,11 @@ def _power_off_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_power_off_request( + _request = build_virtual_machines_delete_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, - skip_shutdown=skip_shutdown, + force_deletion=force_deletion, api_version=api_version, headers=_headers, params=_params, @@ -16863,7 +17128,7 @@ def _power_off_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -16871,30 +17136,32 @@ def _power_off_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_power_off( - self, resource_group_name: str, vm_name: str, *, skip_shutdown: bool = False, **kwargs: Any + def begin_delete( + self, resource_group_name: str, vm_name: str, *, force_deletion: Optional[bool] = None, **kwargs: Any ) -> LROPoller[None]: - """The operation to power off (stop) a virtual machine. The virtual machine can be restarted with - the same provisioned resources. You are still charged for this virtual machine. NOTE: This - operation is not allowed on a virtual machine that is being deallocated or has already been - deallocated. + """The operation to delete a virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this - flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this - flag is false if not specified. Default value is False. - :paramtype skip_shutdown: bool + :keyword force_deletion: Optional parameter to force delete virtual machines. Default value is + None. + :paramtype force_deletion: bool :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -16908,10 +17175,10 @@ def begin_power_off( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._power_off_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, - skip_shutdown=skip_shutdown, + force_deletion=force_deletion, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -16926,7 +17193,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -16940,7 +17209,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16955,7 +17224,7 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_reapply_request( + _request = build_virtual_machines_assess_patches_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, @@ -16981,35 +17250,45 @@ def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_reapply(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]: - """The operation to reapply a virtual machine's state. + def begin_assess_patches( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> LROPoller[_models.VirtualMachineAssessPatchesResult]: + """Assess patches on the VM. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns either VirtualMachineAssessPatchesResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineAssessPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._reapply_initial( + raw_result = self._assess_patches_initial( resource_group_name=resource_group_name, vm_name=vm_name, api_version=api_version, @@ -17021,26 +17300,38 @@ def begin_reapply(self, resource_group_name: str, vm_name: str, **kwargs: Any) - raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineAssessPatchesResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineAssessPatchesResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineAssessPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + def _attach_detach_data_disks_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17049,17 +17340,29 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_restart_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AttachDetachDataDisksRequest") + + _request = build_virtual_machines_attach_detach_data_disks_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -17081,38 +17384,116 @@ def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: _models.AttachDetachDataDisksRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either StorageProfile or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either StorageProfile or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_restart(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]: - """The operation to restart a virtual machine. + def begin_attach_detach_data_disks( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from the virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param parameters: Parameters supplied to the attach and detach data disks operation on the + virtual machine. Is either a AttachDetachDataDisksRequest type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest or + IO[bytes] + :return: An instance of LROPoller that returns either StorageProfile or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restart_initial( + raw_result = self._attach_detach_data_disks_initial( resource_group_name=resource_group_name, vm_name=vm_name, + parameters=parameters, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17121,26 +17502,38 @@ def begin_restart(self, resource_group_name: str, vm_name: str, **kwargs: Any) - raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("StorageProfile", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.StorageProfile].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.StorageProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + def _capture_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachineCaptureParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17149,17 +17542,29 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_start_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "VirtualMachineCaptureParameters") + + _request = build_virtual_machines_capture_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -17181,38 +17586,120 @@ def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_capture( + self, + resource_group_name: str, + vm_name: str, + parameters: _models.VirtualMachineCaptureParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineCaptureResult]: + """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used + to create similar VMs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_capture( + self, + resource_group_name: str, + vm_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineCaptureResult]: + """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used + to create similar VMs. - return deserialized # type: ignore + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_start(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]: - """The operation to start a virtual machine. + def begin_capture( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.VirtualMachineCaptureParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineCaptureResult]: + """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used + to create similar VMs. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param parameters: Parameters supplied to the Capture Virtual Machine operation. Is either a + VirtualMachineCaptureParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureParameters or + IO[bytes] + :return: An instance of LROPoller that returns either VirtualMachineCaptureResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineCaptureResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineCaptureResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._start_initial( + raw_result = self._capture_initial( resource_group_name=resource_group_name, vm_name=vm_name, + parameters=parameters, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17221,26 +17708,34 @@ def begin_start(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineCaptureResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineCaptureResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineCaptureResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + def _convert_to_managed_disks_initial( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17255,7 +17750,7 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_redeploy_request( + _request = build_virtual_machines_convert_to_managed_disks_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, @@ -17281,18 +17776,25 @@ def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: An map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_redeploy(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]: - """Shuts down the virtual machine, moves it to a new node, and powers it back on. + def begin_convert_to_managed_disks(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]: + """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be + stop-deallocated before invoking this operation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str @@ -17309,7 +17811,7 @@ def begin_redeploy(self, resource_group_name: str, vm_name: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._redeploy_initial( + raw_result = self._convert_to_managed_disks_initial( resource_group_name=resource_group_name, vm_name=vm_name, api_version=api_version, @@ -17326,7 +17828,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -17340,12 +17844,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _reimage_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.VirtualMachineReimageParameters, IO[bytes]]] = None, - **kwargs: Any + def _deallocate_initial( + self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17355,32 +17855,18 @@ def _reimage_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "VirtualMachineReimageParameters") - else: - _json = None - - _request = build_virtual_machines_reimage_request( + _request = build_virtual_machines_deallocate_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + hibernate=hibernate, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -17402,120 +17888,50 @@ def _reimage_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[_models.VirtualMachineReimageParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, - for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial - state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineReimageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, - for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial - state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value - is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_reimage( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.VirtualMachineReimageParameters, IO[bytes]]] = None, - **kwargs: Any + def begin_deallocate( + self, resource_group_name: str, vm_name: str, *, hibernate: Optional[bool] = None, **kwargs: Any ) -> LROPoller[None]: - """Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, - for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial - state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If - deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is - delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should - be updated accordingly before performing the reimage. + """Shuts down the virtual machine and releases the compute resources. You are not billed for the + compute resources that this virtual machine uses. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Is either a - VirtualMachineReimageParameters type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineReimageParameters or - IO[bytes] + :keyword hibernate: Optional parameter to hibernate a virtual machine. Default value is None. + :paramtype hibernate: bool :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._reimage_initial( + raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, - parameters=parameters, + hibernate=hibernate, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17529,7 +17945,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -17544,26 +17962,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def retrieve_boot_diagnostics_data( - self, - resource_group_name: str, - vm_name: str, - *, - sas_uri_expiration_time_in_minutes: Optional[int] = None, - **kwargs: Any - ) -> _models.RetrieveBootDiagnosticsDataResult: - """The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + def generalize( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> None: + """Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the + virtual machine before performing this operation. For Windows, please refer to `Create a + managed image of a generalized VM in Azure + `_. For + Linux, please refer to `How to create an image of a virtual machine or VHD + `_. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs - with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated - with a default expiration duration of 120 minutes. Default value is None. - :paramtype sas_uri_expiration_time_in_minutes: int - :return: RetrieveBootDiagnosticsDataResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RetrieveBootDiagnosticsDataResult + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17578,13 +17993,12 @@ def retrieve_boot_diagnostics_data( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machines_retrieve_boot_diagnostics_data_request( + _request = build_virtual_machines_generalize_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, - sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, api_version=api_version, headers=_headers, params=_params, @@ -17602,14 +18016,16 @@ def retrieve_boot_diagnostics_data( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RetrieveBootDiagnosticsDataResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + def _install_patches_initial( + self, + resource_group_name: str, + vm_name: str, + install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17618,17 +18034,29 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_perform_maintenance_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(install_patches_input, (IOBase, bytes)): + _content = install_patches_input + else: + _json = self._serialize.body(install_patches_input, "VirtualMachineInstallPatchesParameters") + + _request = build_virtual_machines_install_patches_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -17650,38 +18078,120 @@ def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + install_patches_input: _models.VirtualMachineInstallPatchesParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstallPatchesParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + install_patches_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_perform_maintenance(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]: - """The operation to perform maintenance on a virtual machine. + def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: + """Installs patches on the VM. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param install_patches_input: Input for InstallPatches as directly received by the API. Is + either a VirtualMachineInstallPatchesParameters type or a IO[bytes] type. Required. + :type install_patches_input: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstallPatchesParameters or IO[bytes] + :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstallPatchesResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._perform_maintenance_initial( + raw_result = self._install_patches_initial( resource_group_name=resource_group_name, vm_name=vm_name, + install_patches_input=install_patches_input, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17690,37 +18200,44 @@ def begin_perform_maintenance(self, resource_group_name: str, vm_name: str, **kw raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstallPatchesResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.VirtualMachineInstallPatchesResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.VirtualMachineInstallPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace - def simulate_eviction( # pylint: disable=inconsistent-return-statements + def instance_view( self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> None: - """The operation to simulate the eviction of spot virtual machine. + ) -> _models.VirtualMachineInstanceView: + """Retrieves information about the run-time state of a virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: None or the result of cls(response) - :rtype: None + :return: VirtualMachineInstanceView or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstanceView :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17735,9 +18252,9 @@ def simulate_eviction( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstanceView] = kwargs.pop("cls", None) - _request = build_virtual_machines_simulate_eviction_request( + _request = build_virtual_machines_instance_view_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, @@ -17754,14 +18271,24 @@ def simulate_eviction( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("VirtualMachineInstanceView", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore - def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: + return deserialized # type: ignore + + def _migrate_to_vm_scale_set_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17770,17 +18297,32 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machines_assess_patches_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "MigrateVMToVirtualMachineScaleSetInput") + else: + _json = None + + _request = build_virtual_machines_migrate_to_vm_scale_set_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -17794,7 +18336,7 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -17802,42 +18344,112 @@ def _assess_patches_initial(self, resource_group_name: str, vm_name: str, **kwar map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_migrate_to_vm_scale_set( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[_models.MigrateVMToVirtualMachineScaleSetInput] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateVMToVirtualMachineScaleSetInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_migrate_to_vm_scale_set( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value + is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_assess_patches( - self, resource_group_name: str, vm_name: str, **kwargs: Any - ) -> LROPoller[_models.VirtualMachineAssessPatchesResult]: - """Assess patches on the VM. + def begin_migrate_to_vm_scale_set( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :return: An instance of LROPoller that returns either VirtualMachineAssessPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineAssessPatchesResult] + :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Is either a + MigrateVMToVirtualMachineScaleSetInput type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateVMToVirtualMachineScaleSetInput + or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._assess_patches_initial( + raw_result = self._migrate_to_vm_scale_set_initial( resource_group_name=resource_group_name, vm_name=vm_name, + parameters=parameters, api_version=api_version, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17846,11 +18458,9 @@ def begin_assess_patches( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineAssessPatchesResult", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -17861,23 +18471,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachineAssessPatchesResult].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachineAssessPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _install_patches_initial( - self, - resource_group_name: str, - vm_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + def _perform_maintenance_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17886,29 +18488,17 @@ def _install_patches_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(install_patches_input, (IOBase, bytes)): - _content = install_patches_input - else: - _json = self._serialize.body(install_patches_input, "VirtualMachineInstallPatchesParameters") - - _request = build_virtual_machines_install_patches_request( + _request = build_virtual_machines_perform_maintenance_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -17930,112 +18520,44 @@ def _install_patches_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def begin_install_patches( - self, - resource_group_name: str, - vm_name: str, - install_patches_input: _models.VirtualMachineInstallPatchesParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstallPatchesParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_install_patches( - self, - resource_group_name: str, - vm_name: str, - install_patches_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_install_patches( - self, - resource_group_name: str, - vm_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """Installs patches on the VM. + def begin_perform_maintenance(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to perform maintenance on a virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. Is - either a VirtualMachineInstallPatchesParameters type or a IO[bytes] type. Required. - :type install_patches_input: - ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstallPatchesParameters or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineInstallPatchesResult] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._install_patches_initial( + raw_result = self._perform_maintenance_initial( resource_group_name=resource_group_name, vm_name=vm_name, - install_patches_input=install_patches_input, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -18044,11 +18566,9 @@ def begin_install_patches( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineInstallPatchesResult", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -18059,22 +18579,16 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachineInstallPatchesResult].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachineInstallPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _attach_detach_data_disks_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], - **kwargs: Any + def _power_off_initial( + self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -18084,29 +18598,18 @@ def _attach_detach_data_disks_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AttachDetachDataDisksRequest") - - _request = build_virtual_machines_attach_detach_data_disks_request( + _request = build_virtual_machines_power_off_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + skip_shutdown=skip_shutdown, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -18131,109 +18634,49 @@ def _attach_detach_data_disks_initial( response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.AttachDetachDataDisksRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def begin_attach_detach_data_disks( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.StorageProfile]: - """Attach and detach data disks to/from the virtual machine. + def begin_power_off( + self, resource_group_name: str, vm_name: str, *, skip_shutdown: Optional[bool] = None, **kwargs: Any + ) -> LROPoller[None]: + """The operation to power off (stop) a virtual machine. The virtual machine can be restarted with + the same provisioned resources. You are still charged for this virtual machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the attach and detach data disks operation on the - virtual machine. Is either a AttachDetachDataDisksRequest type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest or - IO[bytes] - :return: An instance of LROPoller that returns either StorageProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. Default value is None. + :paramtype skip_shutdown: bool + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._attach_detach_data_disks_initial( + raw_result = self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, - parameters=parameters, + skip_shutdown=skip_shutdown, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -18242,11 +18685,9 @@ def begin_attach_detach_data_disks( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageProfile", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -18257,23 +18698,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.StorageProfile].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.StorageProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _migrate_to_vm_scale_set_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any - ) -> Iterator[bytes]: + def _reapply_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18282,32 +18715,17 @@ def _migrate_to_vm_scale_set_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "MigrateVMToVirtualMachineScaleSetInput") - else: - _json = None - - _request = build_virtual_machines_migrate_to_vm_scale_set_request( + _request = build_virtual_machines_reapply_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -18321,7 +18739,7 @@ def _migrate_to_vm_scale_set_initial( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -18329,105 +18747,44 @@ def _migrate_to_vm_scale_set_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def begin_migrate_to_vm_scale_set( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[_models.MigrateVMToVirtualMachineScaleSetInput] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value - is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateVMToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_migrate_to_vm_scale_set( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Default value - is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_migrate_to_vm_scale_set( - self, - resource_group_name: str, - vm_name: str, - parameters: Optional[Union[_models.MigrateVMToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Migrate a virtual machine from availability set to Flexible Virtual Machine Scale Set. + def begin_reapply(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to reapply a virtual machine's state. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Migrate Virtual Machine operation. Is either a - MigrateVMToVirtualMachineScaleSetInput type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateVMToVirtualMachineScaleSetInput - or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_to_vm_scale_set_initial( + raw_result = self._reapply_initial( resource_group_name=resource_group_name, vm_name=vm_name, - parameters=parameters, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -18441,7 +18798,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -18455,13 +18814,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _run_command_initial( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + def _redeploy_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18470,29 +18823,17 @@ def _run_command_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RunCommandInput") - - _request = build_virtual_machines_run_command_request( + _request = build_virtual_machines_redeploy_request( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -18514,105 +18855,44 @@ def _run_command_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_run_command( - self, - resource_group_name: str, - vm_name: str, - parameters: _models.RunCommandInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on the VM. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_run_command( - self, - resource_group_name: str, - vm_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on the VM. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine. Required. - :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - @distributed_trace - def begin_run_command( - self, - resource_group_name: str, - vm_name: str, - parameters: Union[_models.RunCommandInput, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.RunCommandResult]: - """Run command on the VM. + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - :param resource_group_name: The name of the resource group. Required. + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_redeploy(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]: + """Shuts down the virtual machine, moves it to a new node, and powers it back on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param parameters: Parameters supplied to the Run command operation. Is either a - RunCommandInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput or IO[bytes] - :return: An instance of LROPoller that returns either RunCommandResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._redeploy_initial( resource_group_name=resource_group_name, vm_name=vm_name, - parameters=parameters, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -18621,11 +18901,9 @@ def begin_run_command( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RunCommandResult", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -18636,57 +18914,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.RunCommandResult].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.RunCommandResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - -class VirtualMachineImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machine_images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get( - self, location: str, publisher_name: str, offer: str, skus: str, version: str, **kwargs: Any - ) -> _models.VirtualMachineImage: - """Gets a virtual machine image. + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param version: A valid image SKU version. Required. - :type version: str - :return: VirtualMachineImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _reimage_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.VirtualMachineReimageParameters, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18695,138 +18937,205 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_get_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, - version=version, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "VirtualMachineReimageParameters") + else: + _json = None + + _request = build_virtual_machines_reimage_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineImage", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def list( + @overload + def begin_reimage( self, - location: str, - publisher_name: str, - offer: str, - skus: str, + resource_group_name: str, + vm_name: str, + parameters: Optional[_models.VirtualMachineReimageParameters] = None, *, - expand: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of all virtual machine image versions for the specified location, publisher, offer, - and SKU. + ) -> LROPoller[None]: + """Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, + for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :keyword top: Default value is None. - :paramtype top: int - :keyword orderby: Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineReimageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_list_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, - subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, + for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. - response = pipeline_response.http_response + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + @distributed_trace + def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional[Union[_models.VirtualMachineReimageParameters, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Reimages (upgrade the operating system) a virtual machine which don't have a ephemeral OS disk, + for virtual machines who have a ephemeral OS disk the virtual machine is reset to initial + state. NOTE: The retaining of old OS disk depends on the value of deleteOption of OS disk. If + deleteOption is detach, the old OS disk will be preserved after reimage. If deleteOption is + delete, the old OS disk will be deleted after reimage. The deleteOption of the OS disk should + be updated accordingly before performing the reimage. - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Is either a + VirtualMachineReimageParameters type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineReimageParameters or + IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - return deserialized # type: ignore + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def list_offers( - self, location: str, publisher_name: str, **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of virtual machine image offers for the specified location and publisher. + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _restart_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18839,11 +19148,11 @@ def list_offers( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_list_offers_request( - location=location, - publisher_name=publisher_name, + _request = build_virtual_machines_restart_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -18851,89 +19160,111 @@ def list_offers( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list_publishers(self, location: str, **kwargs: Any) -> List[_models.VirtualMachineImageResource]: - """Gets a list of virtual machine image publishers for the specified Azure location. + def begin_restart(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to restart a virtual machine. - :param location: The name of a supported Azure region. Required. - :type location: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_images_list_publishers_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - return deserialized # type: ignore + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_skus( - self, location: str, publisher_name: str, offer: str, **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + def retrieve_boot_diagnostics_data( + self, + resource_group_name: str, + vm_name: str, + *, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs: Any + ) -> _models.RetrieveBootDiagnosticsDataResult: + """The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs + with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated + with a default expiration duration of 120 minutes. Default value is None. + :paramtype sas_uri_expiration_time_in_minutes: int + :return: RetrieveBootDiagnosticsDataResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RetrieveBootDiagnosticsDataResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -18948,13 +19279,13 @@ def list_skus( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_list_skus_request( - location=location, - publisher_name=publisher_name, - offer=offer, + _request = build_virtual_machines_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, api_version=api_version, headers=_headers, params=_params, @@ -18972,25 +19303,20 @@ def list_skus( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + deserialized = self._deserialize("RetrieveBootDiagnosticsDataResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_by_edge_zone(self, location: str, edge_zone: str, **kwargs: Any) -> _models.VmImagesInEdgeZoneListResult: - """Gets a list of all virtual machine image versions for the specified edge zone. - - :param location: The name of a supported Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :return: VmImagesInEdgeZoneListResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VmImagesInEdgeZoneListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _run_command_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.RunCommandInput, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18999,188 +19325,203 @@ def list_by_edge_zone(self, location: str, edge_zone: str, **kwargs: Any) -> _mo } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VmImagesInEdgeZoneListResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_list_by_edge_zone_request( - location=location, - edge_zone=edge_zone, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RunCommandInput") + + _request = build_virtual_machines_run_command_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VmImagesInEdgeZoneListResult", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_with_properties( + @overload + def begin_run_command( self, - location: str, - publisher_name: str, - offer: str, - skus: str, + resource_group_name: str, + vm_name: str, + parameters: _models.RunCommandInput, *, - expand: Union[str, _models.Expand], - top: Optional[int] = None, - orderby: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> Iterable["_models.VirtualMachineImage"]: - """list_with_properties. + ) -> LROPoller[_models.RunCommandResult]: + """Run command on the VM. - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :keyword expand: The expand expression to apply on the operation. "Properties" Required. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.Expand - :keyword top: Default value is None. - :paramtype top: int - :keyword orderby: Default value is None. - :paramtype orderby: str - :return: An iterator like instance of either VirtualMachineImage or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineImagesWithPropertiesListResult] = kwargs.pop("cls", None) + @overload + def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Run command on the VM. - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ - def prepare_request(next_link=None): - if not next_link: + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + parameters: Union[_models.RunCommandInput, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Run command on the VM. - _request = build_virtual_machine_images_list_with_properties_request( - location=location, - publisher_name=publisher_name, - offer=offer, - skus=skus, - subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param parameters: Parameters supplied to the Run command operation. Is either a + RunCommandInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput or IO[bytes] + :return: An instance of LROPoller that returns either RunCommandResult or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._run_command_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineImagesWithPropertiesListResult", pipeline_response) - list_of_elem = deserialized.value + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RunCommandResult", pipeline_response.http_response) if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class VirtualMachineImagesEdgeZoneOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machine_images_edge_zone` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get( - self, location: str, edge_zone: str, publisher_name: str, offer: str, skus: str, version: str, **kwargs: Any - ) -> _models.VirtualMachineImage: - """Gets a virtual machine image in an edge zone. - - :param location: The name of a supported Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :param version: A valid image SKU version. Required. - :type version: str - :return: VirtualMachineImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImage + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.RunCommandResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RunCommandResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def simulate_eviction( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> None: + """The operation to simulate the eviction of spot virtual machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19195,15 +19536,11 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineImage] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_edge_zone_get_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - skus=skus, - version=version, + _request = build_virtual_machines_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -19218,56 +19555,14 @@ def get( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineImage", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, - location: str, - edge_zone: str, - publisher_name: str, - offer: str, - skus: str, - *, - expand: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of all virtual machine image versions for the specified location, edge zone, - publisher, offer, and SKU. + return cls(pipeline_response, None, {}) # type: ignore - :param location: The name of a supported Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :param skus: A valid image SKU. Required. - :type skus: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :keyword top: An integer value specifying the number of images to return that matches supplied - values. Default value is None. - :paramtype top: int - :keyword orderby: Specifies the order of the results returned. Formatted as an OData query. - Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _start_initial(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19280,116 +19575,123 @@ def list( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_images_edge_zone_list_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - skus=skus, + _request = build_virtual_machines_start_request( + resource_group_name=resource_group_name, + vm_name=vm_name, subscription_id=self._config.subscription_id, - expand=expand, - top=top, - orderby=orderby, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list_offers( - self, location: str, edge_zone: str, publisher_name: str, **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of virtual machine image offers for the specified location, edge zone and - publisher. + def begin_start(self, resource_group_name: str, vm_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to start a virtual machine. - :param location: The name of a supported Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) - - _request = build_virtual_machine_images_edge_zone_list_offers_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - return deserialized # type: ignore + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_publishers( - self, location: str, edge_zone: str, **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + def list_available_sizes( + self, resource_group_name: str, vm_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualMachineSize"]: + """Lists all available virtual machine sizes to which the specified virtual machine can be + resized. - :param location: The name of a supported Azure region. Required. - :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19398,59 +19700,98 @@ def list_publishers( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + _request = build_virtual_machines_list_available_sizes_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - _request = build_virtual_machine_images_edge_zone_list_publishers_request( - location=location, - edge_zone=edge_zone, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return pipeline_response - response = pipeline_response.http_response + return ItemPaged(get_next, extract_data) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) +class VirtualMachineSizesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`virtual_machine_sizes` attribute. + """ - return deserialized # type: ignore + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list_skus( - self, location: str, edge_zone: str, publisher_name: str, offer: str, **kwargs: Any - ) -> List[_models.VirtualMachineImageResource]: - """Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and - offer. + def list(self, location: str, **kwargs: Any) -> Iterable["_models.VirtualMachineSize"]: + """This API is deprecated. Use `Resources Skus + `_. - :param location: The name of a supported Azure region. Required. + :param location: The name of Azure region. Required. :type location: str - :param edge_zone: The name of the edge zone. Required. - :type edge_zone: str - :param publisher_name: A valid image publisher. Required. - :type publisher_name: str - :param offer: A valid image publisher offer. Required. - :type offer: str - :return: list of VirtualMachineImageResource or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineImageResource] + :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19459,81 +19800,96 @@ def list_skus( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineImageResource]] = kwargs.pop("cls", None) + _request = build_virtual_machine_sizes_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machine_images_edge_zone_list_skus_request( - location=location, - edge_zone=edge_zone, - publisher_name=publisher_name, - offer=offer, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("[VirtualMachineImageResource]", pipeline_response.http_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) -class VirtualMachineExtensionImagesOperations: +class ProximityPlacementGroupsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machine_extension_images` attribute. + :attr:`proximity_placement_groups` attribute. """ models = _models def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def get( - self, location: str, publisher_name: str, type: str, version: str, **kwargs: Any - ) -> _models.VirtualMachineExtensionImage: - """Gets a virtual machine extension image. + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ProximityPlacementGroup"]: + """Lists all proximity placement groups in a subscription. - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :param type: Required. - :type type: str - :param version: Required. - :type version: str - :return: VirtualMachineExtensionImage or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionImage + :return: An iterator like instance of either ProximityPlacementGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.ProximityPlacementGroupListResult] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19542,56 +19898,79 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineExtensionImage] = kwargs.pop("cls", None) + _request = build_proximity_placement_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machine_extension_images_get_request( - location=location, - publisher_name=publisher_name, - type=type, - version=version, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("VirtualMachineExtensionImage", pipeline_response.http_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def list_types( - self, location: str, publisher_name: str, **kwargs: Any - ) -> List[_models.VirtualMachineExtensionImage]: - """Gets a list of virtual machine extension image types. + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ProximityPlacementGroup"]: + """Lists all proximity placement groups in a resource group. - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :return: list of VirtualMachineExtensionImage or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionImage] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either ProximityPlacementGroup or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.ProximityPlacementGroupListResult] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19600,68 +19979,80 @@ def list_types( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + def prepare_request(next_link=None): + if not next_link: - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) + _request = build_proximity_placement_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _request = build_virtual_machine_extension_images_list_types_request( - location=location, - publisher_name=publisher_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - deserialized = self._deserialize("[VirtualMachineExtensionImage]", pipeline_response.http_response) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def list_versions( + def get( self, - location: str, - publisher_name: str, - type: str, + resource_group_name: str, + proximity_placement_group_name: str, *, - filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, + include_colocation_status: Optional[str] = None, **kwargs: Any - ) -> List[_models.VirtualMachineExtensionImage]: - """Gets a list of virtual machine extension image versions. + ) -> _models.ProximityPlacementGroup: + """Retrieves information about a proximity placement group . - :param location: The name of a supported Azure region. Required. - :type location: str - :param publisher_name: Required. - :type publisher_name: str - :param type: Required. - :type type: str - :keyword filter: The filter to apply on the operation. Default value is None. - :paramtype filter: str - :keyword top: Default value is None. - :paramtype top: int - :keyword orderby: Default value is None. - :paramtype orderby: str - :return: list of VirtualMachineExtensionImage or the result of cls(response) - :rtype: list[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionImage] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :keyword include_colocation_status: includeColocationStatus=true enables fetching the + colocation status of all the resources in the proximity placement group. Default value is None. + :paramtype include_colocation_status: str + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19676,16 +20067,13 @@ def list_versions( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[List[_models.VirtualMachineExtensionImage]] = kwargs.pop("cls", None) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) - _request = build_virtual_machine_extension_images_list_versions_request( - location=location, - publisher_name=publisher_name, - type=type, + _request = build_proximity_placement_groups_get_request( + resource_group_name=resource_group_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, - filter=filter, - top=top, - orderby=orderby, + include_colocation_status=include_colocation_status, api_version=api_version, headers=_headers, params=_params, @@ -19703,57 +20091,38 @@ def list_versions( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("[VirtualMachineExtensionImage]", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - -class AvailabilitySetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`availability_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - @overload def create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.AvailabilitySet, + proximity_placement_group_name: str, + parameters: _models.ProximityPlacementGroup, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -19761,25 +20130,27 @@ def create_or_update( def create_or_update( self, resource_group_name: str, - availability_set_name: str, + proximity_placement_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Required. + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -19787,21 +20158,22 @@ def create_or_update( def create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.AvailabilitySet, IO[bytes]], + proximity_placement_group_name: str, + parameters: Union[_models.ProximityPlacementGroup, IO[bytes]], **kwargs: Any - ) -> _models.AvailabilitySet: - """Create or update an availability set. + ) -> _models.ProximityPlacementGroup: + """Create or update a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Create Availability Set operation. Is either a - AvailabilitySet type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet or IO[bytes] - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Is + either a ProximityPlacementGroup type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup or IO[bytes] + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19817,7 +20189,7 @@ def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -19825,11 +20197,11 @@ def create_or_update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "AvailabilitySet") + _json = self._serialize.body(parameters, "ProximityPlacementGroup") - _request = build_availability_sets_create_or_update_request( + _request = build_proximity_placement_groups_create_or_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -19847,11 +20219,11 @@ def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19862,25 +20234,27 @@ def create_or_update( def update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.AvailabilitySetUpdate, + proximity_placement_group_name: str, + parameters: _models.ProximityPlacementGroupUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySetUpdate + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroupUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -19888,25 +20262,27 @@ def update( def update( self, resource_group_name: str, - availability_set_name: str, + proximity_placement_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Required. + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ @@ -19914,21 +20290,23 @@ def update( def update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.AvailabilitySetUpdate, IO[bytes]], + proximity_placement_group_name: str, + parameters: Union[_models.ProximityPlacementGroupUpdate, IO[bytes]], **kwargs: Any - ) -> _models.AvailabilitySet: - """Update an availability set. + ) -> _models.ProximityPlacementGroup: + """Update a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the Update Availability Set operation. Is either a - AvailabilitySetUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySetUpdate or IO[bytes] - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Is + either a ProximityPlacementGroupUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroupUpdate or + IO[bytes] + :return: ProximityPlacementGroup or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19944,7 +20322,7 @@ def update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -19952,11 +20330,11 @@ def update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "AvailabilitySetUpdate") + _json = self._serialize.body(parameters, "ProximityPlacementGroupUpdate") - _request = build_availability_sets_update_request( + _request = build_proximity_placement_groups_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -19978,7 +20356,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) + deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -19987,14 +20365,15 @@ def update( @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, availability_set_name: str, **kwargs: Any + self, resource_group_name: str, proximity_placement_group_name: str, **kwargs: Any ) -> None: - """Delete an availability set. + """Delete a proximity placement group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str + :param proximity_placement_group_name: The name of the proximity placement group. Required. + :type proximity_placement_group_name: str :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -20013,9 +20392,9 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_availability_sets_delete_request( + _request = build_proximity_placement_groups_delete_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + proximity_placement_group_name=proximity_placement_group_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -20030,85 +20409,51 @@ def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def get(self, resource_group_name: str, availability_set_name: str, **kwargs: Any) -> _models.AvailabilitySet: - """Retrieves information about an availability set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: AvailabilitySet or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.AvailabilitySet] = kwargs.pop("cls", None) - - _request = build_availability_sets_get_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) +class RestorePointCollectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`restore_point_collections` attribute. + """ - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + models = _models - return deserialized # type: ignore + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list_by_subscription( - self, *, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.AvailabilitySet"]: - """Lists all availability sets in a subscription. + def list_all(self, **kwargs: Any) -> Iterable["_models.RestorePointCollection"]: + """Gets the list of restore point collections in the subscription. Use nextLink property in the + response to get the next page of restore point collections. Do this till nextLink is not null + to fetch all the restore point collections. - :keyword expand: The expand expression to apply to the operation. Allowed values are - 'virtualMachines/$ref'. Default value is None. - :paramtype expand: str - :return: An iterator like instance of either AvailabilitySet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet] + :return: An iterator like instance of either RestorePointCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollectionListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20121,9 +20466,8 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - _request = build_availability_sets_list_by_subscription_request( + _request = build_restore_point_collections_list_all_request( subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -20148,7 +20492,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -20172,20 +20516,23 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.AvailabilitySet"]: - """Lists all availability sets in a resource group. + def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.RestorePointCollection"]: + """Gets the list of restore point collections in a resource group. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either AvailabilitySet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.AvailabilitySet] + :return: An iterator like instance of either RestorePointCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollectionListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20198,7 +20545,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Ava def prepare_request(next_link=None): if not next_link: - _request = build_availability_sets_list_request( + _request = build_restore_point_collections_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -20225,7 +20572,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("AvailabilitySetListResult", pipeline_response) + deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -20249,26 +20596,30 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_available_sizes( - self, resource_group_name: str, availability_set_name: str, **kwargs: Any - ) -> Iterable["_models.VirtualMachineSize"]: - """Lists all available virtual machine sizes that can be used to create a new virtual machine in - an existing availability set. + def get( + self, + resource_group_name: str, + restore_point_collection_name: str, + *, + expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, + **kwargs: Any + ) -> _models.RestorePointCollection: + """The operation to get the restore point collection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: An iterator like instance of either VirtualMachineSize or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineSize] + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :keyword expand: The expand expression to apply on the operation. If expand=restorePoints, + server will return all contained restore points in the restorePointCollection. "restorePoints" + Default value is None. + :paramtype expand: str or + ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionExpandOptions + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20277,140 +20628,123 @@ def list_available_sizes( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_availability_sets_list_available_sizes_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + _request = build_restore_point_collections_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - def get_next(next_link=None): - _request = prepare_request(next_link) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return pipeline_response + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload - def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + def create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.MigrateToVirtualMachineScaleSetInput, + restore_point_collection_name: str, + parameters: _models.RestorePointCollection, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. + ) -> _models.RestorePointCollection: + """The operation to create or update the restore point collection. Please refer to + https://aka.ms/RestorePoints for more details. When updating a restore point collection, only + tags may be modified. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def start_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + def create_or_update( self, resource_group_name: str, - availability_set_name: str, + restore_point_collection_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. + ) -> _models.RestorePointCollection: + """The operation to create or update the restore point collection. Please refer to + https://aka.ms/RestorePoints for more details. When updating a restore point collection, only + tags may be modified. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long + def create_or_update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, IO[bytes]], + restore_point_collection_name: str, + parameters: Union[_models.RestorePointCollection, IO[bytes]], **kwargs: Any - ) -> None: - """Start migration operation on an Availability Set to move its Virtual Machines to a Virtual - Machine Scale Set. This should be followed by a migrate operation on each Virtual Machine that - triggers a downtime on the Virtual Machine. + ) -> _models.RestorePointCollection: + """The operation to create or update the restore point collection. Please refer to + https://aka.ms/RestorePoints for more details. When updating a restore point collection, only + tags may be modified. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is - either a MigrateToVirtualMachineScaleSetInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput - or IO[bytes] - :return: None or the result of cls(response) - :rtype: None + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. Is either a RestorePointCollection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection or IO[bytes] + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20426,7 +20760,7 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsisten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -20434,11 +20768,11 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsisten if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "MigrateToVirtualMachineScaleSetInput") + _json = self._serialize.body(parameters, "RestorePointCollection") - _request = build_availability_sets_start_migration_to_virtual_machine_scale_set_request( + _request = build_restore_point_collections_create_or_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -20456,142 +20790,94 @@ def start_migration_to_virtual_machine_scale_set( # pylint: disable=inconsisten response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def cancel_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long - self, resource_group_name: str, availability_set_name: str, **kwargs: Any - ) -> None: - """Cancel the migration operation on an Availability Set. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_availability_sets_cancel_migration_to_virtual_machine_scale_set_request( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload - def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + def update( self, resource_group_name: str, - availability_set_name: str, - parameters: _models.MigrateToVirtualMachineScaleSetInput, + restore_point_collection_name: str, + parameters: _models.RestorePointCollectionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def validate_migration_to_virtual_machine_scale_set( # pylint: disable=name-too-long + def update( self, resource_group_name: str, - availability_set_name: str, + restore_point_collection_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def validate_migration_to_virtual_machine_scale_set( # pylint: disable=inconsistent-return-statements,name-too-long + def update( self, resource_group_name: str, - availability_set_name: str, - parameters: Union[_models.MigrateToVirtualMachineScaleSetInput, IO[bytes]], + restore_point_collection_name: str, + parameters: Union[_models.RestorePointCollectionUpdate, IO[bytes]], **kwargs: Any - ) -> None: - """Validates that the Virtual Machines in the Availability Set can be migrated to the provided - Virtual Machine Scale Set. + ) -> _models.RestorePointCollection: + """The operation to update the restore point collection. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is - either a MigrateToVirtualMachineScaleSetInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.MigrateToVirtualMachineScaleSetInput - or IO[bytes] - :return: None or the result of cls(response) - :rtype: None + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. Is + either a RestorePointCollectionUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionUpdate or + IO[bytes] + :return: RestorePointCollection or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20607,7 +20893,7 @@ def validate_migration_to_virtual_machine_scale_set( # pylint: disable=inconsis api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -20615,11 +20901,11 @@ def validate_migration_to_virtual_machine_scale_set( # pylint: disable=inconsis if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "MigrateToVirtualMachineScaleSetInput") + _json = self._serialize.body(parameters, "RestorePointCollectionUpdate") - _request = build_availability_sets_validate_migration_to_virtual_machine_scale_set_request( + _request = build_restore_point_collections_update_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -20637,19 +20923,19 @@ def validate_migration_to_virtual_machine_scale_set( # pylint: disable=inconsis response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore - def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20659,32 +20945,17 @@ def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-l } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "ConvertToVirtualMachineScaleSetInput") - else: - _json = None - - _request = build_availability_sets_convert_to_virtual_machine_scale_set_request( + _request = build_restore_point_collections_delete_request( resource_group_name=resource_group_name, - availability_set_name=availability_set_name, + restore_point_collection_name=restore_point_collection_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -20698,7 +20969,7 @@ def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-l response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -20706,229 +20977,386 @@ def _convert_to_virtual_machine_scale_set_initial( # pylint: disable=name-too-l map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[_models.ConvertToVirtualMachineScaleSetInput] = None, - *, - content_type: str = "application/json", - **kwargs: Any + @distributed_trace + def begin_delete( + self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any ) -> LROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. + """The operation to delete the restore point collection. This operation will also delete all the + contained restore points. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ConvertToVirtualMachineScaleSetInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class SshPublicKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`ssh_public_keys` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SshPublicKeyResource"]: + """Lists all of the SSH public keys in the subscription. Use the nextLink property in the response + to get the next page of SSH public keys. + + :return: An iterator like instance of either SshPublicKeyResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.SshPublicKeysGroupListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ssh_public_keys_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.SshPublicKeyResource"]: + """Lists all of the SSH public keys in the specified resource group. Use the nextLink property in + the response to get the next page of SSH public keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either SshPublicKeyResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.SshPublicKeysGroupListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_ssh_public_keys_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - @overload - def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. + def get_next(next_link=None): + _request = prepare_request(next_link) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. - Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace - def begin_convert_to_virtual_machine_scale_set( # pylint: disable=name-too-long - self, - resource_group_name: str, - availability_set_name: str, - parameters: Optional[Union[_models.ConvertToVirtualMachineScaleSetInput, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Create a new Flexible Virtual Machine Scale Set and migrate all the Virtual Machines in the - Availability Set. This does not trigger a downtime on the Virtual Machines. + def get(self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any) -> _models.SshPublicKeyResource: + """Retrieves information about an SSH public key. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param availability_set_name: The name of the availability set. Required. - :type availability_set_name: str - :param parameters: Parameters supplied to the migrate operation on the availability set. Is - either a ConvertToVirtualMachineScaleSetInput type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ConvertToVirtualMachineScaleSetInput - or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._convert_to_virtual_machine_scale_set_initial( - resource_group_name=resource_group_name, - availability_set_name=availability_set_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore + _request = build_ssh_public_keys_get_request( + resource_group_name=resource_group_name, + ssh_public_key_name=ssh_public_key_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response -class ProximityPlacementGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`proximity_placement_groups` attribute. - """ + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) - models = _models + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + return deserialized # type: ignore @overload - def create_or_update( + def create( self, resource_group_name: str, - proximity_placement_group_name: str, - parameters: _models.ProximityPlacementGroup, + ssh_public_key_name: str, + parameters: _models.SshPublicKeyResource, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def create( self, resource_group_name: str, - proximity_placement_group_name: str, + ssh_public_key_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def create( self, resource_group_name: str, - proximity_placement_group_name: str, - parameters: Union[_models.ProximityPlacementGroup, IO[bytes]], + ssh_public_key_name: str, + parameters: Union[_models.SshPublicKeyResource, IO[bytes]], **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Create or update a proximity placement group. + ) -> _models.SshPublicKeyResource: + """Creates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Create Proximity Placement Group operation. Is - either a ProximityPlacementGroup type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup or IO[bytes] - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. Is either a + SshPublicKeyResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource or IO[bytes] + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20944,7 +21372,7 @@ def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -20952,11 +21380,11 @@ def create_or_update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "ProximityPlacementGroup") + _json = self._serialize.body(parameters, "SshPublicKeyResource") - _request = build_proximity_placement_groups_create_or_update_request( + _request = build_ssh_public_keys_create_request( resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -20978,7 +21406,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -20989,26 +21417,26 @@ def create_or_update( def update( self, resource_group_name: str, - proximity_placement_group_name: str, - parameters: _models.ProximityPlacementGroupUpdate, + ssh_public_key_name: str, + parameters: _models.SshPublicKeyUpdateResource, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroupUpdate + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyUpdateResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @@ -21016,26 +21444,26 @@ def update( def update( self, resource_group_name: str, - proximity_placement_group_name: str, + ssh_public_key_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ @@ -21043,22 +21471,23 @@ def update( def update( self, resource_group_name: str, - proximity_placement_group_name: str, - parameters: Union[_models.ProximityPlacementGroupUpdate, IO[bytes]], + ssh_public_key_name: str, + parameters: Union[_models.SshPublicKeyUpdateResource, IO[bytes]], **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Update a proximity placement group. + ) -> _models.SshPublicKeyResource: + """Updates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :param parameters: Parameters supplied to the Update Proximity Placement Group operation. Is - either a ProximityPlacementGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroupUpdate or + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. Is either a + SshPublicKeyUpdateResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyUpdateResource or IO[bytes] - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :return: SshPublicKeyResource or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -21074,7 +21503,7 @@ def update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21082,11 +21511,11 @@ def update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "ProximityPlacementGroupUpdate") + _json = self._serialize.body(parameters, "SshPublicKeyUpdateResource") - _request = build_proximity_placement_groups_update_request( + _request = build_ssh_public_keys_update_request( resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -21108,7 +21537,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -21117,14 +21546,15 @@ def update( @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, proximity_placement_group_name: str, **kwargs: Any + self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any ) -> None: - """Delete a proximity placement group. + """Delete an SSH public key. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -21143,9 +21573,9 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_proximity_placement_groups_delete_request( + _request = build_ssh_public_keys_delete_request( resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -21160,33 +21590,94 @@ def delete( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def get( + @overload + def generate_key_pair( self, resource_group_name: str, - proximity_placement_group_name: str, + ssh_public_key_name: str, + parameters: Optional[_models.SshGenerateKeyPairInputParameters] = None, *, - include_colocation_status: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> _models.ProximityPlacementGroup: - """Retrieves information about a proximity placement group . + ) -> _models.SshPublicKeyGenerateKeyPairResult: + """Generates and returns a public/private key pair and populates the SSH public key resource with + the public key. The length of the key will be 3072 bits. This operation can only be performed + once per SSH public key resource. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param proximity_placement_group_name: The name of the proximity placement group. Required. - :type proximity_placement_group_name: str - :keyword include_colocation_status: includeColocationStatus=true enables fetching the - colocation status of all the resources in the proximity placement group. Default value is None. - :paramtype include_colocation_status: str - :return: ProximityPlacementGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshGenerateKeyPairInputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyGenerateKeyPairResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SshPublicKeyGenerateKeyPairResult: + """Generates and returns a public/private key pair and populates the SSH public key resource with + the public key. The length of the key will be 3072 bits. This operation can only be performed + once per SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Default value is None. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyGenerateKeyPairResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: Optional[Union[_models.SshGenerateKeyPairInputParameters, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.SshPublicKeyGenerateKeyPairResult: + """Generates and returns a public/private key pair and populates the SSH public key resource with + the public key. The length of the key will be 3072 bits. This operation can only be performed + once per SSH public key resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. Required. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to generate the SSH public key. Is either a + SshGenerateKeyPairInputParameters type or a IO[bytes] type. Default value is None. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshGenerateKeyPairInputParameters or + IO[bytes] + :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyGenerateKeyPairResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -21197,18 +21688,32 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ProximityPlacementGroup] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SshPublicKeyGenerateKeyPairResult] = kwargs.pop("cls", None) - _request = build_proximity_placement_groups_get_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _json = self._serialize.body(parameters, "SshGenerateKeyPairInputParameters") + else: + _json = None + + _request = build_ssh_public_keys_generate_key_pair_request( resource_group_name=resource_group_name, - proximity_placement_group_name=proximity_placement_group_name, + ssh_public_key_name=ssh_public_key_name, subscription_id=self._config.subscription_id, - include_colocation_status=include_colocation_status, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -21225,108 +21730,56 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProximityPlacementGroup", pipeline_response.http_response) + deserialized = self._deserialize("SshPublicKeyGenerateKeyPairResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ProximityPlacementGroup"]: - """Lists all proximity placement groups in a subscription. - - :return: An iterator like instance of either ProximityPlacementGroup or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ProximityPlacementGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_proximity_placement_groups_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) +class CapacityReservationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - return pipeline_response + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`capacity_reservations` attribute. + """ - return ItemPaged(get_next, extract_data) + models = _models - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ProximityPlacementGroup"]: - """Lists all proximity placement groups in a resource group. + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - :param resource_group_name: The name of the resource group. Required. + @distributed_trace + def list_by_capacity_reservation_group( + self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any + ) -> Iterable["_models.CapacityReservation"]: + """Lists all of the capacity reservations in the specified capacity reservation group. Use the + nextLink property in the response to get the next page of capacity reservations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either ProximityPlacementGroup or the result of - cls(response) + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :return: An iterator like instance of either CapacityReservation or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.ProximityPlacementGroup] + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ProximityPlacementGroupListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CapacityReservationListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -21339,8 +21792,9 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - _request = build_proximity_placement_groups_list_by_resource_group_request( + _request = build_capacity_reservations_list_by_capacity_reservation_group_request( resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -21366,7 +21820,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("ProximityPlacementGroupListResult", pipeline_response) + deserialized = self._deserialize("CapacityReservationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -21389,106 +21843,306 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + @distributed_trace + def get( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + *, + expand: Optional[Union[str, _models.CapacityReservationInstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.CapacityReservation: + """The operation that retrieves information about the capacity reservation. -class DedicatedHostGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves a + snapshot of the runtime properties of the capacity reservation that is managed by the platform + and can change outside of control plane operations. "instanceView" Default value is None. + :paramtype expand: str or + ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationInstanceViewTypes + :return: CapacityReservation or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`dedicated_host_groups` attribute. - """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - models = _models + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + _request = build_capacity_reservations_get_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservation, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CapacityReservation") + + _request = build_capacity_reservations_create_or_update_request( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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=_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, - host_group_name: str, - parameters: _models.DedicatedHostGroup, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: _models.CapacityReservation, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host - Groups please see [Dedicated Host Documentation] - (https://go.microsoft.com/fwlink/?linkid=2082596). + ) -> LROPoller[_models.CapacityReservation]: + """The operation to create or update a capacity reservation. Please note some properties can be + set only during capacity reservation creation. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservation :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup + :return: An instance of LROPoller that returns either CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, - host_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host - Groups please see [Dedicated Host Documentation] - (https://go.microsoft.com/fwlink/?linkid=2082596). + ) -> LROPoller[_models.CapacityReservation]: + """The operation to create or update a capacity reservation. Please note some properties can be + set only during capacity reservation creation. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup + :return: An instance of LROPoller that returns either CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservation, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CapacityReservation]: + """The operation to create or update a capacity reservation. Please note some properties can be + set only during capacity reservation creation. Please refer to + https://aka.ms/CapacityReservation for more details. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. Is either a + CapacityReservation type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservation or IO[bytes] + :return: An instance of LROPoller that returns either CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @distributed_trace - def create_or_update( + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CapacityReservation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CapacityReservation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( self, resource_group_name: str, - host_group_name: str, - parameters: Union[_models.DedicatedHostGroup, IO[bytes]], + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservationUpdate, IO[bytes]], **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host - Groups please see [Dedicated Host Documentation] - (https://go.microsoft.com/fwlink/?linkid=2082596). - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Create Dedicated Host Group. Is either a - DedicatedHostGroup type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup or IO[bytes] - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21502,7 +22156,7 @@ def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -21510,11 +22164,12 @@ def create_or_update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "DedicatedHostGroup") + _json = self._serialize.body(parameters, "CapacityReservationUpdate") - _request = build_dedicated_host_groups_create_or_update_request( + _request = build_capacity_reservations_update_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -21525,165 +22180,182 @@ def create_or_update( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def update( + def begin_update( self, resource_group_name: str, - host_group_name: str, - parameters: _models.DedicatedHostGroupUpdate, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: _models.CapacityReservationUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> LROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroupUpdate + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup + :return: An instance of LROPoller that returns either CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def begin_update( self, resource_group_name: str, - host_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> LROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Required. + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup + :return: An instance of LROPoller that returns either CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( + def begin_update( self, resource_group_name: str, - host_group_name: str, - parameters: Union[_models.DedicatedHostGroupUpdate, IO[bytes]], + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: Union[_models.CapacityReservationUpdate, IO[bytes]], **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Update an dedicated host group. + ) -> LROPoller[_models.CapacityReservation]: + """The operation to update a capacity reservation. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param parameters: Parameters supplied to the Update Dedicated Host Group operation. Is either - a DedicatedHostGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroupUpdate or IO[bytes] - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. Is either + a CapacityReservationUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationUpdate or IO[bytes] + :return: An instance of LROPoller that returns either CapacityReservation or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DedicatedHostGroupUpdate") - - _request = build_dedicated_host_groups_update_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - return deserialized # type: ignore + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, host_group_name: str, **kwargs: Any - ) -> None: - """Delete a dedicated host group. + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CapacityReservation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CapacityReservation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _delete_initial( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21696,11 +22368,12 @@ def delete( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_dedicated_host_groups_delete_request( + _request = build_capacity_reservations_delete_request( resource_group_name=resource_group_name, - host_group_name=host_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -21708,103 +22381,142 @@ def delete( # pylint: disable=inconsistent-return-statements ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get( + def begin_delete( self, resource_group_name: str, - host_group_name: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + capacity_reservation_group_name: str, + capacity_reservation_name: str, **kwargs: Any - ) -> _models.DedicatedHostGroup: - """Retrieves information about a dedicated host group. + ) -> LROPoller[None]: + """The operation to delete a capacity reservation. This operation is allowed only when all the + associated resources are disassociated from the capacity reservation. Please refer to + https://aka.ms/CapacityReservation for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve - the list of instance views of the dedicated hosts under the dedicated host group. 'UserData' is - not supported for dedicated host group. Known values are: "instanceView", "userData", and - "resiliencyView". Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes - :return: DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup + :param capacity_reservation_group_name: The name of the capacity reservation group. Required. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. Required. + :type capacity_reservation_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.DedicatedHostGroup] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + capacity_reservation_group_name=capacity_reservation_group_name, + capacity_reservation_name=capacity_reservation_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - _request = build_dedicated_host_groups_get_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) +class DedicatedHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - deserialized = self._deserialize("DedicatedHostGroup", pipeline_response.http_response) + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`dedicated_hosts` attribute. + """ - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + models = _models - return deserialized # type: ignore + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.DedicatedHostGroup"]: - """Lists all of the dedicated host groups in the specified resource group. Use the nextLink - property in the response to get the next page of dedicated host groups. + def list_by_host_group( + self, resource_group_name: str, host_group_name: str, **kwargs: Any + ) -> Iterable["_models.DedicatedHost"]: + """Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink + property in the response to get the next page of dedicated hosts. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup] + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :return: An iterator like instance of either DedicatedHost or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.DedicatedHost] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.DedicatedHostGroupListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -21817,8 +22529,9 @@ 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_dedicated_host_groups_list_by_resource_group_request( + _request = build_dedicated_hosts_list_by_host_group_request( resource_group_name=resource_group_name, + host_group_name=host_group_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -21844,7 +22557,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) + deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -21868,100 +22581,76 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DedicatedHostGroup"]: - """Lists all of the dedicated host groups in the subscription. Use the nextLink property in the - response to get the next page of dedicated host groups. - - :return: An iterator like instance of either DedicatedHostGroup or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.DedicatedHostGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.DedicatedHostGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_dedicated_host_groups_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DedicatedHostGroupListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + def get( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.DedicatedHost: + """Retrieves information about a dedicated host. - def get_next(next_link=None): - _request = prepare_request(next_link) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. Required. + :type host_group_name: str + :param host_name: The name of the dedicated host. Required. + :type host_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve + the list of instance views of the dedicated host. 'UserData' is not supported for dedicated + host. Known values are: "instanceView", "userData", and "resiliencyView". Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes + :return: DedicatedHost or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) - return pipeline_response + _request = build_dedicated_hosts_get_request( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - return ItemPaged(get_next, extract_data) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response -class DedicatedHostsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`dedicated_hosts` attribute. - """ + deserialized = self._deserialize("DedicatedHost", pipeline_response.http_response) - models = _models + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + return deserialized # type: ignore def _create_or_update_initial( self, @@ -22024,10 +22713,15 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -22044,11 +22738,12 @@ def begin_create_or_update( ) -> LROPoller[_models.DedicatedHost]: """Create or update a dedicated host . - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param host_name: The name of the dedicated host . Required. + :param host_name: The name of the dedicated host. Required. :type host_name: str :param parameters: Parameters supplied to the Create Dedicated Host. Required. :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHost @@ -22074,11 +22769,12 @@ def begin_create_or_update( ) -> LROPoller[_models.DedicatedHost]: """Create or update a dedicated host . - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param host_name: The name of the dedicated host . Required. + :param host_name: The name of the dedicated host. Required. :type host_name: str :param parameters: Parameters supplied to the Create Dedicated Host. Required. :type parameters: IO[bytes] @@ -22102,11 +22798,12 @@ def begin_create_or_update( ) -> LROPoller[_models.DedicatedHost]: """Create or update a dedicated host . - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param host_name: The name of the dedicated host . Required. + :param host_name: The name of the dedicated host. Required. :type host_name: str :param parameters: Parameters supplied to the Create Dedicated Host. Is either a DedicatedHost type or a IO[bytes] type. Required. @@ -22148,7 +22845,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -22225,10 +22924,14 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -22245,11 +22948,12 @@ def begin_update( ) -> LROPoller[_models.DedicatedHost]: """Update a dedicated host . - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param host_name: The name of the dedicated host . Required. + :param host_name: The name of the dedicated host. Required. :type host_name: str :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. :type parameters: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHostUpdate @@ -22275,11 +22979,12 @@ def begin_update( ) -> LROPoller[_models.DedicatedHost]: """Update a dedicated host . - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param host_name: The name of the dedicated host . Required. + :param host_name: The name of the dedicated host. Required. :type host_name: str :param parameters: Parameters supplied to the Update Dedicated Host operation. Required. :type parameters: IO[bytes] @@ -22303,11 +23008,12 @@ def begin_update( ) -> LROPoller[_models.DedicatedHost]: """Update a dedicated host . - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str - :param host_name: The name of the dedicated host . Required. + :param host_name: The name of the dedicated host. Required. :type host_name: str :param parameters: Parameters supplied to the Update Dedicated Host operation. Is either a DedicatedHostUpdate type or a IO[bytes] type. Required. @@ -22343,13 +23049,20 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("DedicatedHost", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -22409,10 +23122,15 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -22422,7 +23140,8 @@ def begin_delete( ) -> LROPoller[None]: """Delete a dedicated host. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str @@ -22459,7 +23178,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -22474,96 +23195,29 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - host_group_name: str, - host_name: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any - ) -> _models.DedicatedHost: - """Retrieves information about a dedicated host. + def list_available_sizes( + self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any + ) -> Iterable[str]: + """Lists all available dedicated host sizes to which the specified dedicated host can be resized. + NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated + host. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str :param host_name: The name of the dedicated host. Required. :type host_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve - the list of instance views of the dedicated host. 'UserData' is not supported for dedicated - host. Known values are: "instanceView", "userData", and "resiliencyView". Default value is - None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes - :return: DedicatedHost or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.DedicatedHost - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.DedicatedHost] = kwargs.pop("cls", None) - - _request = build_dedicated_hosts_get_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DedicatedHost", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_host_group( - self, resource_group_name: str, host_group_name: str, **kwargs: Any - ) -> Iterable["_models.DedicatedHost"]: - """Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink - property in the response to get the next page of dedicated hosts. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :return: An iterator like instance of either DedicatedHost or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.DedicatedHost] + :return: An iterator like instance of either str or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[str] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.DedicatedHostListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.DedicatedHostSizeListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -22576,9 +23230,10 @@ def list_by_host_group( def prepare_request(next_link=None): if not next_link: - _request = build_dedicated_hosts_list_by_host_group_request( + _request = build_dedicated_hosts_list_available_sizes_request( resource_group_name=resource_group_name, host_group_name=host_group_name, + host_name=host_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -22604,7 +23259,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("DedicatedHostListResult", pipeline_response) + deserialized = self._deserialize("DedicatedHostSizeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -22627,7 +23282,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _restart_initial( + def _redeploy_initial( self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -22644,7 +23299,7 @@ def _restart_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_dedicated_hosts_restart_request( + _request = build_dedicated_hosts_redeploy_request( resource_group_name=resource_group_name, host_group_name=host_group_name, host_name=host_name, @@ -22663,7 +23318,7 @@ def _restart_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -22671,23 +23326,29 @@ def _restart_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_restart( + def begin_redeploy( self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any ) -> LROPoller[None]: - """Restart the dedicated host. The operation will complete successfully once the dedicated host - has restarted and is running. To determine the health of VMs deployed on the dedicated host - after the restart check the Resource Health Center in the Azure Portal. Please refer to - https://docs.microsoft.com/azure/service-health/resource-health-overview for more details. + """Redeploy the dedicated host. The operation will complete successfully once the dedicated host + has migrated to a new node and is running. To determine the health of VMs deployed on the + dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please + refer to https://docs.microsoft.com/azure/service-health/resource-health-overview for more + details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str @@ -22706,7 +23367,7 @@ def begin_restart( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._restart_initial( + raw_result = self._redeploy_initial( resource_group_name=resource_group_name, host_group_name=host_group_name, host_name=host_name, @@ -22724,7 +23385,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -22738,7 +23401,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _redeploy_initial( + def _restart_initial( self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -22755,7 +23418,7 @@ def _redeploy_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_dedicated_hosts_redeploy_request( + _request = build_dedicated_hosts_restart_request( resource_group_name=resource_group_name, host_group_name=host_group_name, host_name=host_name, @@ -22774,7 +23437,7 @@ def _redeploy_initial( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -22784,6 +23447,7 @@ def _redeploy_initial( response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -22793,16 +23457,16 @@ def _redeploy_initial( return deserialized # type: ignore @distributed_trace - def begin_redeploy( + def begin_restart( self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any ) -> LROPoller[None]: - """Redeploy the dedicated host. The operation will complete successfully once the dedicated host - has migrated to a new node and is running. To determine the health of VMs deployed on the - dedicated host after the redeploy check the Resource Health Center in the Azure Portal. Please - refer to https://docs.microsoft.com/azure/service-health/resource-health-overview for more - details. + """Restart the dedicated host. The operation will complete successfully once the dedicated host + has restarted and is running. To determine the health of VMs deployed on the dedicated host + after the restart check the Resource Health Center in the Azure Portal. Please refer to + https://docs.microsoft.com/azure/service-health/resource-health-overview for more details. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param host_group_name: The name of the dedicated host group. Required. :type host_group_name: str @@ -22821,7 +23485,7 @@ def begin_redeploy( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._redeploy_initial( + raw_result = self._restart_initial( resource_group_name=resource_group_name, host_group_name=host_group_name, host_name=host_name, @@ -22839,7 +23503,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -22853,30 +23519,105 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + +class RestorePointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`restore_points` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace - def list_available_sizes( - self, resource_group_name: str, host_group_name: str, host_name: str, **kwargs: Any - ) -> Iterable[str]: - """Lists all available dedicated host sizes to which the specified dedicated host can be resized. - NOTE: The dedicated host sizes provided can be used to only scale up the existing dedicated - host. + def get( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + *, + expand: Optional[Union[str, _models.RestorePointExpandOptions]] = None, + **kwargs: Any + ) -> _models.RestorePoint: + """The operation to get the restore point. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param host_group_name: The name of the dedicated host group. Required. - :type host_group_name: str - :param host_name: The name of the dedicated host. Required. - :type host_name: str - :return: An iterator like instance of either str or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[str] + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves + information about the run-time state of a restore point. "instanceView" Default value is None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.RestorePointExpandOptions + :return: RestorePoint or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePoint :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.DedicatedHostSizeListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + + _request = build_restore_points_get_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RestorePoint", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: Union[_models.RestorePoint, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22885,99 +23626,211 @@ def list_available_sizes( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_dedicated_hosts_list_available_sizes_request( - resource_group_name=resource_group_name, - host_group_name=host_group_name, - host_name=host_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RestorePoint") - def extract_data(pipeline_response): - deserialized = self._deserialize("DedicatedHostSizeListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + _request = build_restore_points_create_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - def get_next(next_link=None): - _request = prepare_request(next_link) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + if response.status_code not in [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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return pipeline_response + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return ItemPaged(get_next, extract_data) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore -class SshPublicKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + return deserialized # type: ignore - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`ssh_public_keys` attribute. - """ + @overload + def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: _models.RestorePoint, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RestorePoint]: + """The operation to create the restore point. Updating properties of an existing restore point is + not allowed. - models = _models + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RestorePoint or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RestorePoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @overload + def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RestorePoint]: + """The operation to create the restore point. Updating properties of an existing restore point is + not allowed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RestorePoint or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RestorePoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SshPublicKeyResource"]: - """Lists all of the SSH public keys in the subscription. Use the nextLink property in the response - to get the next page of SSH public keys. + def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: Union[_models.RestorePoint, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.RestorePoint]: + """The operation to create the restore point. Updating properties of an existing restore point is + not allowed. - :return: An iterator like instance of either SshPublicKeyResource or the result of + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. Is either a + RestorePoint type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePoint or IO[bytes] + :return: An instance of LROPoller that returns either RestorePoint or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RestorePoint] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.SshPublicKeysGroupListResult] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("RestorePoint", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.RestorePoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RestorePoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + def _delete_initial( + self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -22986,213 +23839,135 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SshPublicKeyR } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_ssh_public_keys_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + _request = build_restore_points_delete_request( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - def extract_data(pipeline_response): - deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if response.status_code not in [200, 202, 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return pipeline_response + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SshPublicKeyResource"]: - """Lists all of the SSH public keys in the specified resource group. Use the nextLink property in - the response to get the next page of SSH public keys. + def begin_delete( + self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + ) -> LROPoller[None]: + """The operation to delete the restore point. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either SshPublicKeyResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource] + :param restore_point_collection_name: The name of the restore point collection. Required. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. Required. + :type restore_point_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.SshPublicKeysGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_ssh_public_keys_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SshPublicKeysGroupListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + restore_point_name=restore_point_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - return pipeline_response + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @overload - def create( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: _models.SshPublicKeyResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ +class VirtualMachineScaleSetRollingUpgradesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. - @overload - def create( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`virtual_machine_scale_set_rolling_upgrades` attribute. + """ - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + models = _models - @distributed_trace - def create( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Union[_models.SshPublicKeyResource, IO[bytes]], - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Creates a new SSH public key resource. + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to create the SSH public key. Is either a - SshPublicKeyResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource or IO[bytes] - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _start_extension_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23201,126 +23976,112 @@ def create( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SshPublicKeyResource") + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_ssh_public_keys_create_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_start_extension_upgrade_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: _models.SshPublicKeyUpdateResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. + @distributed_trace + def begin_start_extension_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to + the latest available extension version. Instances which are already running the latest + extension versions are not affected. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyUpdateResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @overload - def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_extension_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def update( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Union[_models.SshPublicKeyUpdateResource, IO[bytes]], - **kwargs: Any - ) -> _models.SshPublicKeyResource: - """Updates a new SSH public key resource. + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to update the SSH public key. Is either a - SshPublicKeyUpdateResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyUpdateResource or - IO[bytes] - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _start_os_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23329,66 +24090,110 @@ def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SshPublicKeyUpdateResource") + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_ssh_public_keys_update_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_start_os_upgrade_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any - ) -> None: - """Delete an SSH public key. + def begin_start_os_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Starts a rolling upgrade to move all virtual machine scale set instances to the latest + available Platform Image OS version. Instances which are already running the latest available + OS version are not affected. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :return: None or the result of cls(response) - :rtype: None + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_os_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _cancel_initial(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23401,11 +24206,11 @@ def delete( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_ssh_public_keys_delete_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_cancel_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -23413,30 +24218,102 @@ def delete( # pylint: disable=inconsistent-return-statements ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get(self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any) -> _models.SshPublicKeyResource: - """Retrieves information about an SSH public key. + def begin_cancel(self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any) -> LROPoller[None]: + """Cancels the current virtual machine scale set rolling upgrade. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :return: SshPublicKeyResource or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyResource + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._cancel_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_latest( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> _models.RollingUpgradeStatusInfo: + """Gets the status of the latest virtual machine scale set rolling upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: RollingUpgradeStatusInfo or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RollingUpgradeStatusInfo :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -23451,11 +24328,11 @@ def get(self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.SshPublicKeyResource] = kwargs.pop("cls", None) + cls: ClsType[_models.RollingUpgradeStatusInfo] = kwargs.pop("cls", None) - _request = build_ssh_public_keys_get_request( + _request = build_virtual_machine_scale_set_rolling_upgrades_get_latest_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -23468,97 +24345,148 @@ def get(self, resource_group_name: str, ssh_public_key_name: str, **kwargs: Any) _request, stream=_stream, **kwargs ) - response = pipeline_response.http_response + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RollingUpgradeStatusInfo", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class VirtualMachineScaleSetExtensionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`virtual_machine_scale_set_extensions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_group_name: str, vm_scale_set_name: str, **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetExtension"]: + """Gets a list of all extensions in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :return: An iterator like instance of either VirtualMachineScaleSetExtension or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetExtensionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + _request = build_virtual_machine_scale_set_extensions_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - deserialized = self._deserialize("SshPublicKeyResource", pipeline_response.http_response) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetExtensionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - return deserialized # type: ignore + def get_next(next_link=None): + _request = prepare_request(next_link) - @overload - def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[_models.SshGenerateKeyPairInputParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyGenerateKeyPairResult: - """Generates and returns a public/private key pair and populates the SSH public key resource with - the public key. The length of the key will be 3072 bits. This operation can only be performed - once per SSH public key resource. + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshGenerateKeyPairInputParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - @overload - def generate_key_pair( - self, - resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SshPublicKeyGenerateKeyPairResult: - """Generates and returns a public/private key pair and populates the SSH public key resource with - the public key. The length of the key will be 3072 bits. This operation can only be performed - once per SSH public key resource. + return pipeline_response - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyGenerateKeyPairResult - :raises ~azure.core.exceptions.HttpResponseError: - """ + return ItemPaged(get_next, extract_data) @distributed_trace - def generate_key_pair( + def get( self, resource_group_name: str, - ssh_public_key_name: str, - parameters: Optional[Union[_models.SshGenerateKeyPairInputParameters, IO[bytes]]] = None, + vm_scale_set_name: str, + vmss_extension_name: str, + *, + expand: Optional[str] = None, **kwargs: Any - ) -> _models.SshPublicKeyGenerateKeyPairResult: - """Generates and returns a public/private key pair and populates the SSH public key resource with - the public key. The length of the key will be 3072 bits. This operation can only be performed - once per SSH public key resource. + ) -> _models.VirtualMachineScaleSetExtension: + """The operation to get the extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param ssh_public_key_name: The name of the SSH public key. Required. - :type ssh_public_key_name: str - :param parameters: Parameters supplied to generate the SSH public key. Is either a - SshGenerateKeyPairInputParameters type or a IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.SshGenerateKeyPairInputParameters or - IO[bytes] - :return: SshPublicKeyGenerateKeyPairResult or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.SshPublicKeyGenerateKeyPairResult + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetExtension or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -23569,32 +24497,19 @@ def generate_key_pair( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SshPublicKeyGenerateKeyPairResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "SshGenerateKeyPairInputParameters") - else: - _json = None + cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) - _request = build_ssh_public_keys_generate_key_pair_request( + _request = build_virtual_machine_scale_set_extensions_get_request( resource_group_name=resource_group_name, - ssh_public_key_name=ssh_public_key_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -23611,36 +24526,20 @@ def generate_key_pair( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SshPublicKeyGenerateKeyPairResult", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - -class ImagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`images` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - def _create_or_update_initial( - self, resource_group_name: str, image_name: str, parameters: Union[_models.Image, IO[bytes]], **kwargs: Any + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetExtension, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -23660,14 +24559,15 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _json = self._serialize.body(parameters, "Image") + _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetExtension") - _request = build_images_create_or_update_request( + _request = build_virtual_machine_scale_set_extensions_create_or_update_request( resource_group_name=resource_group_name, - image_name=image_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -23694,10 +24594,15 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -23705,25 +24610,33 @@ def _create_or_update_initial( def begin_create_or_update( self, resource_group_name: str, - image_name: str, - parameters: _models.Image, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: _models.VirtualMachineScaleSetExtension, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Image]: - """Create or update an image. + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: + """The operation to create or update an extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.Image + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] + :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -23731,43 +24644,61 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - image_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Image]: - """Create or update an image. + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: + """The operation to create or update an extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Required. - :type parameters: IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] + :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def begin_create_or_update( - self, resource_group_name: str, image_name: str, parameters: Union[_models.Image, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Image]: - """Create or update an image. + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetExtension, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: + """The operation to create or update an extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Create Image operation. Is either a Image type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.Image or IO[bytes] - :return: An instance of LROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. Is either a VirtualMachineScaleSetExtension type or a IO[bytes] type. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension or IO[bytes] + :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -23775,15 +24706,16 @@ def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - image_name=image_name, - parameters=parameters, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + extension_parameters=extension_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -23795,33 +24727,36 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Image", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.Image].from_continuation_token( + return LROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Image]( + return LROPoller[_models.VirtualMachineScaleSetExtension]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) def _update_initial( self, resource_group_name: str, - image_name: str, - parameters: Union[_models.ImageUpdate, IO[bytes]], + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -23842,14 +24777,15 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _json = self._serialize.body(parameters, "ImageUpdate") + _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetExtensionUpdate") - _request = build_images_update_request( + _request = build_virtual_machine_scale_set_extensions_update_request( resource_group_name=resource_group_name, - image_name=image_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -23876,10 +24812,15 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -23887,25 +24828,33 @@ def _update_initial( def begin_update( self, resource_group_name: str, - image_name: str, - parameters: _models.ImageUpdate, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: _models.VirtualMachineScaleSetExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Image]: - """Update an image. + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: + """The operation to update an extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ImageUpdate + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] + :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -23913,25 +24862,32 @@ def begin_update( def begin_update( self, resource_group_name: str, - image_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Image]: - """Update an image. + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: + """The operation to update an extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Required. - :type parameters: IO[bytes] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] + :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -23939,21 +24895,29 @@ def begin_update( def begin_update( self, resource_group_name: str, - image_name: str, - parameters: Union[_models.ImageUpdate, IO[bytes]], + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetExtensionUpdate, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Image]: - """Update an image. + ) -> LROPoller[_models.VirtualMachineScaleSetExtension]: + """The operation to update an extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :param parameters: Parameters supplied to the Update Image operation. Is either a ImageUpdate - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ImageUpdate or IO[bytes] - :return: An instance of LROPoller that returns either Image or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.Image] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. Is either a VirtualMachineScaleSetExtensionUpdate type or a IO[bytes] type. + Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtensionUpdate or IO[bytes] + :return: An instance of LROPoller that returns either VirtualMachineScaleSetExtension or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -23961,15 +24925,16 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, - image_name=image_name, - parameters=parameters, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + extension_parameters=extension_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -23981,29 +24946,33 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Image", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineScaleSetExtension", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.Image].from_continuation_token( + return LROPoller[_models.VirtualMachineScaleSetExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Image]( + return LROPoller[_models.VirtualMachineScaleSetExtension]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: Any) -> Iterator[bytes]: + def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24018,9 +24987,10 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_images_delete_request( + _request = build_virtual_machine_scale_set_extensions_delete_request( resource_group_name=resource_group_name, - image_name=image_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -24044,21 +25014,31 @@ def _delete_initial(self, resource_group_name: str, image_name: str, **kwargs: A map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_delete(self, resource_group_name: str, image_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes an Image. + def begin_delete( + self, resource_group_name: str, vm_scale_set_name: str, vmss_extension_name: str, **kwargs: Any + ) -> LROPoller[None]: + """The operation to delete the extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. Required. + :type vmss_extension_name: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -24074,7 +25054,8 @@ def begin_delete(self, resource_group_name: str, image_name: str, **kwargs: Any) if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - image_name=image_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -24089,7 +25070,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -24103,81 +25086,66 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def get( - self, resource_group_name: str, image_name: str, *, expand: Optional[str] = None, **kwargs: Any - ) -> _models.Image: - """Gets an image. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param image_name: The name of the image. Required. - :type image_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: Image or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.Image - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.Image] = kwargs.pop("cls", None) - - _request = build_images_get_request( - resource_group_name=resource_group_name, - image_name=image_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) +class VirtualMachineScaleSetVMsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - deserialized = self._deserialize("Image", pipeline_response.http_response) + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`virtual_machine_scale_set_vms` attribute. + """ - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + models = _models - return deserialized # type: ignore + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Image"]: - """Gets the list of images under a resource group. Use nextLink property in the response to get - the next page of Images. Do this till nextLink is null to fetch all the Images. + def list( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + *, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineScaleSetVM"]: + """Gets a list of all virtual machines in a VM scale sets. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either Image or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.Image] + :param virtual_machine_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type virtual_machine_scale_set_name: str + :keyword filter: The filter to apply to the operation. Allowed values are + 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied + eq true', 'properties/latestModelApplied eq false'. Default value is None. + :paramtype filter: str + :keyword select: The list parameters. Allowed values are 'instanceView', + 'instanceView/statuses'. Default value is None. + :paramtype select: str + :keyword expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. Default value is None. + :paramtype expand: str + :return: An iterator like instance of either VirtualMachineScaleSetVM or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ImageListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24190,9 +25158,13 @@ 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_images_list_by_resource_group_request( + _request = build_virtual_machine_scale_set_vms_list_request( resource_group_name=resource_group_name, + virtual_machine_scale_set_name=virtual_machine_scale_set_name, subscription_id=self._config.subscription_id, + filter=filter, + select=select, + expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -24217,7 +25189,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("ImageListResult", pipeline_response) + deserialized = self._deserialize("VirtualMachineScaleSetVMListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -24241,20 +25213,33 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Image"]: - """Gets the list of Images in the subscription. Use nextLink property in the response to get the - next page of Images. Do this till nextLink is null to fetch all the Images. + def get( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.VirtualMachineScaleSetVM: + """Gets a virtual machine from a VM scale set. - :return: An iterator like instance of either Image or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.Image] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve + the instance view of the virtual machine. 'UserData' will retrieve the UserData of the virtual + machine. Known values are: "instanceView", "userData", and "resiliencyView". Default value is + None. + :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.InstanceViewTypes + :return: VirtualMachineScaleSetVM or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.ImageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24263,160 +25248,53 @@ def list(self, **kwargs: Any) -> Iterable["_models.Image"]: } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_images_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ImageListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - return ItemPaged(get_next, extract_data) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) + _request = build_virtual_machine_scale_set_vms_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) -class RestorePointCollectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`restore_point_collections` attribute. - """ + response = pipeline_response.http_response - models = _models + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + deserialized = self._deserialize("VirtualMachineScaleSetVM", pipeline_response.http_response) - @overload - def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: _models.RestorePointCollection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to create or update the restore point collection. Please refer to - https://aka.ms/RestorePoints for more details. When updating a restore point collection, only - tags may be modified. + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + return deserialized # type: ignore - @overload - def create_or_update( + def _update_initial( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: IO[bytes], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.VirtualMachineScaleSetVM, IO[bytes]], *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to create or update the restore point collection. Please refer to - https://aka.ms/RestorePoints for more details. When updating a restore point collection, only - tags may be modified. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - restore_point_collection_name: str, - parameters: Union[_models.RestorePointCollection, IO[bytes]], - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to create or update the restore point collection. Please refer to - https://aka.ms/RestorePoints for more details. When updating a restore point collection, only - tags may be modified. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Create or Update restore point collection - operation. Is either a RestorePointCollection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection or IO[bytes] - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24430,7 +25308,7 @@ def create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -24438,12 +25316,15 @@ def create_or_update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "RestorePointCollection") + _json = self._serialize.body(parameters, "VirtualMachineScaleSetVM") - _request = build_restore_point_collections_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_update_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, api_version=api_version, content_type=content_type, json=_json, @@ -24453,156 +25334,218 @@ def create_or_update( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def update( + def begin_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: _models.RestorePointCollectionUpdate, + vm_scale_set_name: str, + instance_id: str, + parameters: _models.VirtualMachineScaleSetVM, *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> LROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionUpdate + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection + :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def begin_update( self, resource_group_name: str, - restore_point_collection_name: str, + vm_scale_set_name: str, + instance_id: str, parameters: IO[bytes], *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> LROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. Required. :type parameters: IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection + :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( + def begin_update( self, resource_group_name: str, - restore_point_collection_name: str, - parameters: Union[_models.RestorePointCollectionUpdate, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.VirtualMachineScaleSetVM, IO[bytes]], + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to update the restore point collection. + ) -> LROPoller[_models.VirtualMachineScaleSetVM]: + """Updates a virtual machine of a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param parameters: Parameters supplied to the Update restore point collection operation. Is - either a RestorePointCollectionUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionUpdate or - IO[bytes] - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + Is either a VirtualMachineScaleSetVM type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM or IO[bytes] + :keyword if_match: The ETag of the transformation. Omit this value to always overwrite the + current resource. Specify the last-seen ETag value to prevent accidentally overwriting + concurrent changes. Default value is None. + :paramtype if_match: str + :keyword if_none_match: Set to '*' to allow a new record set to be created, but to prevent + updating an existing record set. Other values will result in error from server as they are not + supported. Default value is None. + :paramtype if_none_match: str + :return: An instance of LROPoller that returns either VirtualMachineScaleSetVM or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVM] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RestorePointCollectionUpdate") + cls: ClsType[_models.VirtualMachineScaleSetVM] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - _request = build_restore_point_collections_update_request( - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetVM", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.VirtualMachineScaleSetVM].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualMachineScaleSetVM]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - def _delete_initial( - self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24618,10 +25561,12 @@ def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_restore_point_collections_delete_request( + _request = build_virtual_machine_scale_set_vms_delete_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, + force_deletion=force_deletion, api_version=api_version, headers=_headers, params=_params, @@ -24644,24 +25589,40 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace def begin_delete( - self, resource_group_name: str, restore_point_collection_name: str, **kwargs: Any + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + force_deletion: Optional[bool] = None, + **kwargs: Any ) -> LROPoller[None]: - """The operation to delete the restore point collection. This operation will also delete all the - contained restore points. + """Deletes a virtual machine from a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the Restore Point Collection. Required. - :type restore_point_collection_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword force_deletion: Optional parameter to force delete a virtual machine from a VM scale + set. (Feature in Preview). Default value is None. + :paramtype force_deletion: bool :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -24677,7 +25638,9 @@ def begin_delete( if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + force_deletion=force_deletion, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -24692,7 +25655,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -24706,30 +25671,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def get( - self, - resource_group_name: str, - restore_point_collection_name: str, - *, - expand: Optional[Union[str, _models.RestorePointCollectionExpandOptions]] = None, - **kwargs: Any - ) -> _models.RestorePointCollection: - """The operation to get the restore point collection. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :keyword expand: The expand expression to apply on the operation. If expand=restorePoints, - server will return all contained restore points in the restorePointCollection. "restorePoints" - Default value is None. - :paramtype expand: str or - ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollectionExpandOptions - :return: RestorePointCollection or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _approve_rolling_upgrade_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24742,221 +25686,112 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RestorePointCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_restore_point_collections_get_request( + _request = build_virtual_machine_scale_set_vms_approve_rolling_upgrade_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestorePointCollection", pipeline_response.http_response) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.RestorePointCollection"]: - """Gets the list of restore point collections in a resource group. + def begin_approve_rolling_upgrade( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :return: An iterator like instance of either RestorePointCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RestorePointCollectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_restore_point_collections_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_all(self, **kwargs: Any) -> Iterable["_models.RestorePointCollection"]: - """Gets the list of restore point collections in the subscription. Use nextLink property in the - response to get the next page of restore point collections. Do this till nextLink is not null - to fetch all the restore point collections. - - :return: An iterator like instance of either RestorePointCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.RestorePointCollection] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RestorePointCollectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_restore_point_collections_list_all_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RestorePointCollectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._approve_rolling_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class RestorePointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`restore_points` attribute. - """ + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - models = _models + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _create_initial( + def _attach_detach_data_disks_initial( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: Union[_models.RestorePoint, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -24980,12 +25815,12 @@ def _create_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "RestorePoint") + _json = self._serialize.body(parameters, "AttachDetachDataDisksRequest") - _request = build_restore_points_create_request( + _request = build_virtual_machine_scale_set_vms_attach_detach_data_disks_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -25004,7 +25839,7 @@ def _create_initial( response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -25012,118 +25847,249 @@ def _create_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_create( + def begin_attach_detach_data_disks( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: _models.RestorePoint, + vm_scale_set_name: str, + instance_id: str, + parameters: _models.AttachDetachDataDisksRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RestorePoint]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePoint + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either RestorePoint or the result of + :return: An instance of LROPoller that returns either StorageProfile or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RestorePoint] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create( + def begin_attach_detach_data_disks( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, + vm_scale_set_name: str, + instance_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.RestorePoint]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Required. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either RestorePoint or the result of + :return: An instance of LROPoller that returns either StorageProfile or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RestorePoint] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create( + def begin_attach_detach_data_disks( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, - parameters: Union[_models.RestorePoint, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.AttachDetachDataDisksRequest, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.RestorePoint]: - """The operation to create the restore point. Updating properties of an existing restore point is - not allowed. + ) -> LROPoller[_models.StorageProfile]: + """Attach and detach data disks to/from a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :param parameters: Parameters supplied to the Create restore point operation. Is either a - RestorePoint type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RestorePoint or IO[bytes] - :return: An instance of LROPoller that returns either RestorePoint or the result of + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the attach and detach data disks operation on a + Virtual Machine Scale Sets VM. Is either a AttachDetachDataDisksRequest type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.AttachDetachDataDisksRequest or + IO[bytes] + :return: An instance of LROPoller that returns either StorageProfile or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RestorePoint] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.StorageProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StorageProfile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._attach_detach_data_disks_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("StorageProfile", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.StorageProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.StorageProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _deallocate_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_deallocate_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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=_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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_deallocate( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and + releases the compute resources it uses. You are not billed for the compute resources of this + virtual machine once it is deallocated. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( + raw_result = self._deallocate_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, - parameters=parameters, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -25132,31 +26098,89 @@ def begin_create( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("RestorePoint", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.RestorePoint].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.RestorePoint]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_instance_view( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> _models.VirtualMachineScaleSetVMInstanceView: + """Gets the status of a virtual machine from a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: VirtualMachineScaleSetVMInstanceView or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMInstanceView + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetVMInstanceView] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_get_instance_view_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, ) + _request.url = self._client.format_url(_request.url) - def _delete_initial( - self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualMachineScaleSetVMInstanceView", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _perform_maintenance_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -25172,10 +26196,10 @@ def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_restore_points_delete_request( + _request = build_virtual_machine_scale_set_vms_perform_maintenance_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -25191,7 +26215,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -25199,25 +26223,31 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_delete( - self, resource_group_name: str, restore_point_collection_name: str, restore_point_name: str, **kwargs: Any + def begin_perform_maintenance( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> LROPoller[None]: - """The operation to delete the restore point. + """Performs maintenance on a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param restore_point_collection_name: The name of the Restore Point Collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -25231,10 +26261,10 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._perform_maintenance_initial( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -25249,7 +26279,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -25263,31 +26295,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def get( + def _power_off_initial( self, resource_group_name: str, - restore_point_collection_name: str, - restore_point_name: str, + vm_scale_set_name: str, + instance_id: str, *, - expand: Optional[Union[str, _models.RestorePointExpandOptions]] = None, + skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> _models.RestorePoint: - """The operation to get the restore point. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param restore_point_collection_name: The name of the restore point collection. Required. - :type restore_point_collection_name: str - :param restore_point_name: The name of the restore point. Required. - :type restore_point_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves - information about the run-time state of a restore point. "instanceView" Default value is None. - :paramtype expand: str or ~azure.mgmt.compute.v2024_11_01.models.RestorePointExpandOptions - :return: RestorePoint or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RestorePoint - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25300,138 +26316,124 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RestorePoint] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_restore_points_get_request( + _request = build_virtual_machine_scale_set_vms_power_off_request( resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - expand=expand, + skip_shutdown=skip_shutdown, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RestorePoint", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - -class CapacityReservationGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`capacity_reservation_groups` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: _models.CapacityReservationGroup, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - https://aka.ms/CapacityReservation for more details. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - https://aka.ms/CapacityReservation for more details. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def create_or_update( + def begin_power_off( self, resource_group_name: str, - capacity_reservation_group_name: str, - parameters: Union[_models.CapacityReservationGroup, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + *, + skip_shutdown: Optional[bool] = None, **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to create or update a capacity reservation group. When updating a capacity - reservation group, only tags and sharing profile may be modified. Please refer to - https://aka.ms/CapacityReservation for more details. + ) -> LROPoller[None]: + """Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached + and you are getting charged for the resources. Instead, use deallocate to release resources and + avoid charges. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Create capacity reservation Group. Is either a - CapacityReservationGroup type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup or IO[bytes] - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. Default value is None. + :paramtype skip_shutdown: bool + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + skip_shutdown=skip_shutdown, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _redeploy_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25440,131 +26442,122 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CapacityReservationGroup") + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_capacity_reservation_groups_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_redeploy_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: _models.CapacityReservationGroupUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. + @distributed_trace + def begin_redeploy( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and + powers it back on. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroupUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @overload - def update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def update( + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _reimage_initial( self, resource_group_name: str, - capacity_reservation_group_name: str, - parameters: Union[_models.CapacityReservationGroupUpdate, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetVMReimageParameters, IO[bytes]] + ] = None, **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation to update a capacity reservation group. When updating a capacity reservation - group, only tags and sharing profile may be modified. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param parameters: Parameters supplied to the Update capacity reservation Group operation. Is - either a CapacityReservationGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroupUpdate or - IO[bytes] - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25578,19 +26571,23 @@ def update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservationGroup] = 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(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(vm_scale_set_vm_reimage_input, (IOBase, bytes)): + _content = vm_scale_set_vm_reimage_input else: - _json = self._serialize.body(parameters, "CapacityReservationGroupUpdate") + if vm_scale_set_vm_reimage_input is not None: + _json = self._serialize.body(vm_scale_set_vm_reimage_input, "VirtualMachineScaleSetVMReimageParameters") + else: + _json = None - _request = build_capacity_reservation_groups_update_request( + _request = build_virtual_machine_scale_set_vms_reimage_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -25601,41 +26598,175 @@ def update( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[_models.VirtualMachineScaleSetVMReimageParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + Default value is None. + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMReimageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + Default value is None. + :type vm_scale_set_vm_reimage_input: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any - ) -> None: - """The operation to delete a capacity reservation group. This operation is allowed only if all the - associated resources are disassociated from the reservation group and all capacity reservations - under the reservation group have also been deleted. Please refer to - https://aka.ms/CapacityReservation for more details. + def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional[ + Union[_models.VirtualMachineScaleSetVMReimageParameters, IO[bytes]] + ] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :return: None or the result of cls(response) - :rtype: None + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + Is either a VirtualMachineScaleSetVMReimageParameters type or a IO[bytes] type. Default value + is None. + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMReimageParameters or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _reimage_all_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25648,11 +26779,12 @@ def delete( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_capacity_reservation_groups_delete_request( + _request = build_virtual_machine_scale_set_vms_reimage_all_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -25660,46 +26792,98 @@ def delete( # pylint: disable=inconsistent-return-statements ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - *, - expand: Optional[Union[str, _models.CapacityReservationGroupInstanceViewTypes]] = None, - **kwargs: Any - ) -> _models.CapacityReservationGroup: - """The operation that retrieves information about a capacity reservation group. + def begin_reimage_all( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. + This operation is only supported for managed disks. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' will retrieve - the list of instance views of the capacity reservations under the capacity reservation group - which is a snapshot of the runtime properties of a capacity reservation that is managed by the - platform and can change outside of control plane operations. "instanceView" Default value is - None. - :paramtype expand: str or - ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroupInstanceViewTypes - :return: CapacityReservationGroup or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _restart_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25712,257 +26896,185 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.CapacityReservationGroup] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_capacity_reservation_groups_get_request( + _request = build_virtual_machine_scale_set_vms_restart_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CapacityReservationGroup", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - **kwargs: Any - ) -> Iterable["_models.CapacityReservationGroup"]: - """Lists all of the capacity reservation groups in the specified resource group. Use the nextLink - property in the response to get the next page of capacity reservation groups. + def begin_restart( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Restarts a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :keyword expand: The expand expression to apply on the operation. Based on the expand param(s) - specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are - associated to capacity reservation group in the response. Known values are: - "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. - :paramtype expand: str or - ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForGetCapacityReservationGroups - :return: An iterator like instance of either CapacityReservationGroup or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.CapacityReservationGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_capacity_reservation_groups_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - def extract_data(pipeline_response): - deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) - list_of_elem = deserialized.value + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) + return cls(pipeline_response, None, {}) # type: ignore - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_by_subscription( + def retrieve_boot_diagnostics_data( self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, *, - expand: Optional[Union[str, _models.ExpandTypesForGetCapacityReservationGroups]] = None, - resource_ids_only: Optional[Union[str, _models.ResourceIdOptionsForGetCapacityReservationGroups]] = None, + sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.CapacityReservationGroup"]: - """Lists all of the capacity reservation groups in the subscription. Use the nextLink property in - the response to get the next page of capacity reservation groups. + ) -> _models.RetrieveBootDiagnosticsDataResult: + """The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale + set. - :keyword expand: The expand expression to apply on the operation. Based on the expand param(s) - specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are - associated to capacity reservation group in the response. Known values are: - "virtualMachineScaleSetVMs/$ref" and "virtualMachines/$ref". Default value is None. - :paramtype expand: str or - ~azure.mgmt.compute.v2024_11_01.models.ExpandTypesForGetCapacityReservationGroups - :keyword resource_ids_only: The query option to fetch Capacity Reservation Group Resource Ids. - :code:`
    ` 'CreatedInSubscription' enables fetching Resource Ids for all capacity reservation - group resources created in the subscription. :code:`
    ` 'SharedWithSubscription' enables - fetching Resource Ids for all capacity reservation group resources shared with the - subscription. :code:`
    ` 'All' enables fetching Resource Ids for all capacity reservation - group resources shared with the subscription and created in the subscription. Known values are: - "CreatedInSubscription", "SharedWithSubscription", and "All". Default value is None. - :paramtype resource_ids_only: str or - ~azure.mgmt.compute.v2024_11_01.models.ResourceIdOptionsForGetCapacityReservationGroups - :return: An iterator like instance of either CapacityReservationGroup or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.CapacityReservationGroup] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs + with a value between 1 to 1440 minutes. **Note:** If not specified, SAS URIs will be generated + with a default expiration duration of 120 minutes. Default value is None. + :paramtype sas_uri_expiration_time_in_minutes: int + :return: RetrieveBootDiagnosticsDataResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.RetrieveBootDiagnosticsDataResult :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.CapacityReservationGroupListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_capacity_reservation_groups_list_by_subscription_request( - subscription_id=self._config.subscription_id, - expand=expand, - resource_ids_only=resource_ids_only, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CapacityReservationGroupListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.RetrieveBootDiagnosticsDataResult] = kwargs.pop("cls", None) - return pipeline_response + _request = build_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + sas_uri_expiration_time_in_minutes=sas_uri_expiration_time_in_minutes, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - return ItemPaged(get_next, extract_data) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response -class CapacityReservationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`capacity_reservations` attribute. - """ + deserialized = self._deserialize("RetrieveBootDiagnosticsDataResult", pipeline_response.http_response) - models = _models + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + return deserialized # type: ignore - def _create_or_update_initial( + def _run_command_initial( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservation, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.RunCommandInput, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -25986,12 +27098,12 @@ def _create_or_update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "CapacityReservation") + _json = self._serialize.body(parameters, "RunCommandInput") - _request = build_capacity_reservations_create_or_update_request( + _request = build_virtual_machine_scale_set_vms_run_command_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -26010,7 +27122,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -26018,105 +27130,104 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_run_command( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: _models.CapacityReservation, + vm_scale_set_name: str, + instance_id: str, + parameters: _models.RunCommandInput, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CapacityReservation]: - """The operation to create or update a capacity reservation. Please note some properties can be - set only during capacity reservation creation. Please refer to - https://aka.ms/CapacityReservation for more details. + ) -> LROPoller[_models.RunCommandResult]: + """Run command on a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservation + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either CapacityReservation or the result of + :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_run_command( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, + vm_scale_set_name: str, + instance_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CapacityReservation]: - """The operation to create or update a capacity reservation. Please note some properties can be - set only during capacity reservation creation. Please refer to - https://aka.ms/CapacityReservation for more details. + ) -> LROPoller[_models.RunCommandResult]: + """Run command on a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Required. + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either CapacityReservation or the result of + :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def begin_run_command( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservation, IO[bytes]], + vm_scale_set_name: str, + instance_id: str, + parameters: Union[_models.RunCommandInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.CapacityReservation]: - """The operation to create or update a capacity reservation. Please note some properties can be - set only during capacity reservation creation. Please refer to - https://aka.ms/CapacityReservation for more details. + ) -> LROPoller[_models.RunCommandResult]: + """Run command on a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Create capacity reservation. Is either a - CapacityReservation type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservation or IO[bytes] - :return: An instance of LROPoller that returns either CapacityReservation or the result of + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. Is either a + RunCommandInput type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RunCommandInput or IO[bytes] + :return: An instance of LROPoller that returns either RunCommandResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.RunCommandResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -26124,15 +27235,15 @@ def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + cls: ClsType[_models.RunCommandResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._run_command_initial( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, parameters=parameters, api_version=api_version, content_type=content_type, @@ -26145,35 +27256,88 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) + deserialized = self._deserialize("RunCommandResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.CapacityReservation].from_continuation_token( + return LROPoller[_models.RunCommandResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.CapacityReservation]( + return LROPoller[_models.RunCommandResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _update_initial( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservationUpdate, IO[bytes]], - **kwargs: Any + @distributed_trace + def simulate_eviction( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> None: + """The operation to simulate the eviction of spot virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vms_simulate_eviction_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _start_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26183,30 +27347,18 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CapacityReservationUpdate") - - _request = build_capacity_reservations_update_request( + _request = build_virtual_machine_scale_set_vms_start_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -26228,118 +27380,49 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: _models.CapacityReservationUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CapacityReservation]: - """The operation to update a capacity reservation. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CapacityReservation]: - """The operation to update a capacity reservation. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_update( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - parameters: Union[_models.CapacityReservationUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CapacityReservation]: - """The operation to update a capacity reservation. + def begin_start( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Starts a virtual machine in a VM scale set. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :param parameters: Parameters supplied to the Update capacity reservation operation. Is either - a CapacityReservationUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationUpdate or IO[bytes] - :return: An instance of LROPoller that returns either CapacityReservation or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._start_initial( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, - parameters=parameters, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -26348,36 +27431,147 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.CapacityReservation].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.CapacityReservation]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class VirtualMachineScaleSetVMExtensionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`virtual_machine_scale_set_vm_extensions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.VirtualMachineScaleSetVMExtensionsListResult: + """The operation to get all extensions of an instance in Virtual Machine Scaleset. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetVMExtensionsListResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtensionsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineScaleSetVMExtensionsListResult] = kwargs.pop("cls", None) + + _request = build_virtual_machine_scale_set_vm_extensions_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, ) + _request.url = self._client.format_url(_request.url) - def _delete_initial( + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "VirtualMachineScaleSetVMExtensionsListResult", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + *, + expand: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: + ) -> _models.VirtualMachineScaleSetVMExtension: + """The operation to get the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineScaleSetVMExtension or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26390,132 +27584,48 @@ def _delete_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) - _request = build_capacity_reservations_delete_request( + _request = build_virtual_machine_scale_set_vm_extensions_get_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """The operation to delete a capacity reservation. This operation is allowed only when all the - associated resources are disassociated from the capacity reservation. Please refer to - https://aka.ms/CapacityReservation for more details. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get( + def _create_or_update_initial( self, resource_group_name: str, - capacity_reservation_group_name: str, - capacity_reservation_name: str, - *, - expand: Optional[Union[str, _models.CapacityReservationInstanceViewTypes]] = None, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, IO[bytes]], **kwargs: Any - ) -> _models.CapacityReservation: - """The operation that retrieves information about the capacity reservation. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :param capacity_reservation_name: The name of the capacity reservation. Required. - :type capacity_reservation_name: str - :keyword expand: The expand expression to apply on the operation. 'InstanceView' retrieves a - snapshot of the runtime properties of the capacity reservation that is managed by the platform - and can change outside of control plane operations. "instanceView" Default value is None. - :paramtype expand: str or - ~azure.mgmt.compute.v2024_11_01.models.CapacityReservationInstanceViewTypes - :return: CapacityReservation or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.CapacityReservation - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26524,149 +27634,227 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.CapacityReservation] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_capacity_reservations_get_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters + else: + _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetVMExtension") + + _request = build_virtual_machine_scale_set_vm_extensions_create_or_update_request( resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, - expand=expand, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + 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) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CapacityReservation", pipeline_response.http_response) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineScaleSetVMExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def list_by_capacity_reservation_group( - self, resource_group_name: str, capacity_reservation_group_name: str, **kwargs: Any - ) -> Iterable["_models.CapacityReservation"]: - """Lists all of the capacity reservations in the specified capacity reservation group. Use the - nextLink property in the response to get the next page of capacity reservations. + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtension, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to create or update the VMSS VM extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param capacity_reservation_group_name: The name of the capacity reservation group. Required. - :type capacity_reservation_group_name: str - :return: An iterator like instance of either CapacityReservation or the result of cls(response) + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Is either a VirtualMachineScaleSetVMExtension type or a IO[bytes] type. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension or IO[bytes] + :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the + result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.CapacityReservation] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.CapacityReservationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_capacity_reservations_list_by_capacity_reservation_group_request( - resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - def extract_data(pipeline_response): - deserialized = self._deserialize("CapacityReservationListResult", pipeline_response) - list_of_elem = deserialized.value + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class LogAnalyticsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`log_analytics` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.VirtualMachineScaleSetVMExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _export_request_rate_by_interval_initial( - self, location: str, parameters: Union[_models.RequestRateByIntervalInput, IO[bytes]], **kwargs: Any + def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26686,13 +27874,16 @@ def _export_request_rate_by_interval_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _json = self._serialize.body(parameters, "RequestRateByIntervalInput") + _json = self._serialize.body(extension_parameters, "VirtualMachineScaleSetVMExtensionUpdate") - _request = build_log_analytics_export_request_rate_by_interval_request( - location=location, + _request = build_virtual_machine_scale_set_vm_extensions_update_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -26711,7 +27902,7 @@ def _export_request_rate_by_interval_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -26719,79 +27910,120 @@ def _export_request_rate_by_interval_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def begin_export_request_rate_by_interval( + def begin_update( self, - location: str, - parameters: _models.RequestRateByIntervalInput, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineScaleSetVMExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RequestRateByIntervalInput + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result - of cls(response) + :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the + result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_export_request_rate_by_interval( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type parameters: IO[bytes] + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result - of cls(response) + :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the + result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_export_request_rate_by_interval( - self, location: str, parameters: Union[_models.RequestRateByIntervalInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show Api requests made by this subscription in the given time window to show - throttling activities. + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineScaleSetVMExtensionUpdate, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineScaleSetVMExtension]: + """The operation to update the VMSS VM extension. - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. Is - either a RequestRateByIntervalInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.RequestRateByIntervalInput or - IO[bytes] - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result - of cls(response) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Is either a VirtualMachineScaleSetVMExtensionUpdate type or a IO[bytes] type. + Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtensionUpdate or IO[bytes] + :return: An instance of LROPoller that returns either VirtualMachineScaleSetVMExtension or the + result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineScaleSetVMExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -26799,14 +28031,17 @@ def begin_export_request_rate_by_interval( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineScaleSetVMExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._export_request_rate_by_interval_initial( - location=location, - parameters=parameters, + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -26818,32 +28053,37 @@ def begin_export_request_rate_by_interval( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LogAnalyticsOperationResult", pipeline_response.http_response) + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("VirtualMachineScaleSetVMExtension", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( + return LROPoller[_models.VirtualMachineScaleSetVMExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.LogAnalyticsOperationResult]( + return LROPoller[_models.VirtualMachineScaleSetVMExtension]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _export_throttled_requests_initial( - self, location: str, parameters: Union[_models.ThrottledRequestsInput, IO[bytes]], **kwargs: Any + def _delete_initial( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26853,28 +28093,19 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ThrottledRequestsInput") - - _request = build_log_analytics_export_throttled_requests_request( - location=location, + _request = build_virtual_machine_scale_set_vm_extensions_delete_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) @@ -26888,7 +28119,7 @@ def _export_throttled_requests_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -26896,93 +28127,52 @@ def _export_throttled_requests_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def begin_export_throttled_requests( - self, - location: str, - parameters: _models.ThrottledRequestsInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getThrottledRequests Api. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ThrottledRequestsInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_export_throttled_requests( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. - - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getThrottledRequests Api. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_export_throttled_requests( - self, location: str, parameters: Union[_models.ThrottledRequestsInput, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.LogAnalyticsOperationResult]: - """Export logs that show total throttled Api requests for this subscription in the given time - window. + def begin_delete( + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, vm_extension_name: str, **kwargs: Any + ) -> LROPoller[None]: + """The operation to delete the VMSS VM extension. - :param location: The location upon which virtual-machine-sizes is queried. Required. - :type location: str - :param parameters: Parameters supplied to the LogAnalytics getThrottledRequests Api. Is either - a ThrottledRequestsInput type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.compute.v2024_11_01.models.ThrottledRequestsInput or IO[bytes] - :return: An instance of LROPoller that returns either LogAnalyticsOperationResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.LogAnalyticsOperationResult] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. Required. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. Required. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogAnalyticsOperationResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._export_throttled_requests_initial( - location=location, - parameters=parameters, + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, api_version=api_version, - content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -26991,69 +28181,80 @@ def begin_export_throttled_requests( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LogAnalyticsOperationResult", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.LogAnalyticsOperationResult].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.LogAnalyticsOperationResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore -class VirtualMachineRunCommandsOperations: +class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machine_run_commands` attribute. + :attr:`virtual_machine_scale_set_vm_run_commands` attribute. """ models = _models def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace - def list(self, location: str, **kwargs: Any) -> Iterable["_models.RunCommandDocumentBase"]: - """Lists all available run commands for a subscription in a location. + def list( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.VirtualMachineRunCommand"]: + """The operation to get all run commands of an instance in Virtual Machine Scaleset. - :param location: The location upon which run commands is queried. Required. - :type location: str - :return: An iterator like instance of either RunCommandDocumentBase or the result of + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of either VirtualMachineRunCommand or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.RunCommandDocumentBase] + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RunCommandListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommandsListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -27066,9 +28267,12 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.RunCommandDocu def prepare_request(next_link=None): if not next_link: - _request = build_virtual_machine_run_commands_list_request( - location=location, + _request = build_virtual_machine_scale_set_vm_run_commands_list_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -27093,7 +28297,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("RunCommandListResult", pipeline_response) + deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -27117,15 +28321,31 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get(self, location: str, command_id: str, **kwargs: Any) -> _models.RunCommandDocument: - """Gets specific run command for a subscription in a location. + def get( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.VirtualMachineRunCommand: + """The operation to get the VMSS VM run command. - :param location: The location upon which run commands is queried. Required. - :type location: str - :param command_id: The command id. Required. - :type command_id: str - :return: RunCommandDocument or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.RunCommandDocument + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. + :type run_command_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: VirtualMachineRunCommand or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -27140,12 +28360,15 @@ def get(self, location: str, command_id: str, **kwargs: Any) -> _models.RunComma _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.RunCommandDocument] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - _request = build_virtual_machine_run_commands_get_request( - location=location, - command_id=command_id, + _request = build_virtual_machine_scale_set_vm_run_commands_get_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, subscription_id=self._config.subscription_id, + expand=expand, api_version=api_version, headers=_headers, params=_params, @@ -27163,7 +28386,7 @@ def get(self, location: str, command_id: str, **kwargs: Any) -> _models.RunComma map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RunCommandDocument", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27173,7 +28396,8 @@ def get(self, location: str, command_id: str, **kwargs: Any) -> _models.RunComma def _create_or_update_initial( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], **kwargs: Any @@ -27201,9 +28425,10 @@ def _create_or_update_initial( else: _json = self._serialize.body(run_command, "VirtualMachineRunCommand") - _request = build_virtual_machine_run_commands_create_or_update_request( + _request = build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, run_command_name=run_command_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -27231,10 +28456,15 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -27242,21 +28472,24 @@ def _create_or_update_initial( def begin_create_or_update( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: _models.VirtualMachineRunCommand, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the run command. + """The operation to create or update the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be created or - updated. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. @@ -27275,27 +28508,30 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the run command. + """The operation to create or update the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be created or - updated. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Required. :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is "application/json". + Default value is "application/json". :paramtype content_type: str :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) @@ -27308,19 +28544,22 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the run command. + """The operation to create or update the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be created or - updated. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is either a VirtualMachineRunCommand type or a IO[bytes] type. Required. @@ -27343,7 +28582,8 @@ def begin_create_or_update( if cont_token is None: raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, api_version=api_version, @@ -27363,7 +28603,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -27382,7 +28624,8 @@ def get_long_running_output(pipeline_response): def _update_initial( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], **kwargs: Any @@ -27410,9 +28653,10 @@ def _update_initial( else: _json = self._serialize.body(run_command, "VirtualMachineRunCommandUpdate") - _request = build_virtual_machine_run_commands_update_request( + _request = build_virtual_machine_scale_set_vm_run_commands_update_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, run_command_name=run_command_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -27440,10 +28684,14 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -27451,24 +28699,26 @@ def _update_initial( def begin_update( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: _models.VirtualMachineRunCommandUpdate, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the run command. + """The operation to update the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be updated. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. + :param run_command: Resource create parameters. Required. :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -27484,27 +28734,29 @@ def begin_update( def begin_update( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the run command. + """The operation to update the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be updated. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. - Required. + :param run_command: Resource create parameters. Required. :type run_command: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is "application/json". + Default value is "application/json". :paramtype content_type: str :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of cls(response) @@ -27517,22 +28769,25 @@ def begin_update( def begin_update( self, resource_group_name: str, - vm_name: str, + vm_scale_set_name: str, + instance_id: str, run_command_name: str, run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the run command. + """The operation to update the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be updated. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is - either a VirtualMachineRunCommandUpdate type or a IO[bytes] type. Required. + :param run_command: Resource create parameters. Is either a VirtualMachineRunCommandUpdate type + or a IO[bytes] type. Required. :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandUpdate or IO[bytes] :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of @@ -27553,7 +28808,8 @@ def begin_update( if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, run_command_name=run_command_name, run_command=run_command, api_version=api_version, @@ -27567,13 +28823,20 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -27590,7 +28853,7 @@ def get_long_running_output(pipeline_response): ) def _delete_initial( - self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -27606,9 +28869,10 @@ def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_run_commands_delete_request( + _request = build_virtual_machine_scale_set_vm_run_commands_delete_request( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, run_command_name=run_command_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -27633,25 +28897,32 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace def begin_delete( - self, resource_group_name: str, vm_name: str, run_command_name: str, **kwargs: Any + self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any ) -> LROPoller[None]: - """The operation to delete the run command. + """The operation to delete the VMSS VM run command. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_name: The name of the virtual machine where the run command should be deleted. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VirtualMachineScaleSet. Required. + :type vm_scale_set_name: str + :param instance_id: The name of the VirtualMachineScaleSetVM. Required. + :type instance_id: str + :param run_command_name: The name of the VirtualMachineRunCommand. Required. :type run_command_name: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] @@ -27668,7 +28939,8 @@ def begin_delete( if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - vm_name=vm_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, run_command_name=run_command_name, api_version=api_version, cls=lambda x, y, z: x, @@ -27684,7 +28956,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -27698,28 +28972,42 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + +class VirtualMachineExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s + :attr:`virtual_machine_extensions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + @distributed_trace - def get_by_virtual_machine( - self, - resource_group_name: str, - vm_name: str, - run_command_name: str, - *, - expand: Optional[str] = None, - **kwargs: Any - ) -> _models.VirtualMachineRunCommand: - """The operation to get the run command. + def list( + self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> _models.VirtualMachineExtensionsListResult: + """The operation to get all extensions of a Virtual Machine. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine containing the run command. Required. + :param vm_name: The name of the virtual machine. Required. :type vm_name: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str :keyword expand: The expand expression to apply on the operation. Default value is None. :paramtype expand: str - :return: VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand + :return: VirtualMachineExtensionsListResult or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionsListResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -27734,12 +29022,11 @@ def get_by_virtual_machine( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtensionsListResult] = kwargs.pop("cls", None) - _request = build_virtual_machine_run_commands_get_by_virtual_machine_request( + _request = build_virtual_machine_extensions_list_request( resource_group_name=resource_group_name, vm_name=vm_name, - run_command_name=run_command_name, subscription_id=self._config.subscription_id, expand=expand, api_version=api_version, @@ -27759,7 +29046,7 @@ def get_by_virtual_machine( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineExtensionsListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -27767,29 +29054,30 @@ def get_by_virtual_machine( return deserialized # type: ignore @distributed_trace - def list_by_virtual_machine( - self, resource_group_name: str, vm_name: str, *, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.VirtualMachineRunCommand"]: - """The operation to get all run commands of a Virtual Machine. + def get( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.VirtualMachineExtension: + """The operation to get the extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_name: The name of the virtual machine containing the run command. Required. + :param vm_name: The name of the virtual machine. Required. :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str :keyword expand: The expand expression to apply on the operation. Default value is None. :paramtype expand: str - :return: An iterator like instance of either VirtualMachineRunCommand or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + :return: VirtualMachineExtension or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineRunCommandsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27798,89 +29086,48 @@ def list_by_virtual_machine( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machine_run_commands_list_by_virtual_machine_request( - resource_group_name=resource_group_name, - vm_name=vm_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) - return pipeline_response + _request = build_virtual_machine_extensions_get_request( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - return ItemPaged(get_next, extract_data) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response -class VirtualMachineScaleSetVMRunCommandsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - Instead, you should access the following operations through - :class:`~azure.mgmt.compute.v2024_11_01.ComputeManagementClient`'s - :attr:`virtual_machine_scale_set_vm_run_commands` attribute. - """ + deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) - models = _models + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], + vm_name: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtension, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -27901,16 +29148,15 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _json = self._serialize.body(run_command, "VirtualMachineRunCommand") + _json = self._serialize.body(extension_parameters, "VirtualMachineExtension") - _request = build_virtual_machine_scale_set_vm_run_commands_create_or_update_request( + _request = build_virtual_machine_extensions_create_or_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -27937,10 +29183,15 @@ def _create_or_update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -27948,34 +29199,32 @@ def _create_or_update_initial( def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommand, + vm_name: str, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineExtension, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the VMSS VM run command. + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of + :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -27983,34 +29232,32 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: IO[bytes], + vm_name: str, + vm_extension_name: str, + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the VMSS VM run command. + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type run_command: IO[bytes] + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is "application/json". + Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of + :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -28018,29 +29265,28 @@ def begin_create_or_update( def begin_create_or_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommand, IO[bytes]], + vm_name: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtension, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to create or update the VMSS VM run command. + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to create or update the extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. Is - either a VirtualMachineRunCommand type or a IO[bytes] type. Required. - :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand or IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. Is either a VirtualMachineExtension type or a IO[bytes] type. Required. + :type extension_parameters: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension or + IO[bytes] + :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -28048,17 +29294,16 @@ def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - run_command=run_command, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -28070,35 +29315,36 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) + deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachineRunCommand].from_continuation_token( + return LROPoller[_models.VirtualMachineExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachineRunCommand]( + return LROPoller[_models.VirtualMachineExtension]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) def _update_initial( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], + vm_name: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtensionUpdate, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -28119,16 +29365,15 @@ def _update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(run_command, (IOBase, bytes)): - _content = run_command + if isinstance(extension_parameters, (IOBase, bytes)): + _content = extension_parameters else: - _json = self._serialize.body(run_command, "VirtualMachineRunCommandUpdate") + _json = self._serialize.body(extension_parameters, "VirtualMachineExtensionUpdate") - _request = build_virtual_machine_scale_set_vm_run_commands_update_request( + _request = build_virtual_machine_extensions_update_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -28155,10 +29400,14 @@ def _update_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @@ -28166,34 +29415,33 @@ def _update_initial( def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: _models.VirtualMachineRunCommandUpdate, + vm_name: str, + vm_extension_name: str, + extension_parameters: _models.VirtualMachineExtensionUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the VMSS VM run command. + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandUpdate + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of + :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -28201,65 +29449,61 @@ def begin_update( def begin_update( self, resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: IO[bytes], + vm_name: str, + vm_extension_name: str, + extension_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the VMSS VM run command. + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type run_command: IO[bytes] + :type resource_group_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Required. + :type extension_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is "application/json". + Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of + :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - run_command: Union[_models.VirtualMachineRunCommandUpdate, IO[bytes]], + def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: Union[_models.VirtualMachineExtensionUpdate, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.VirtualMachineRunCommand]: - """The operation to update the VMSS VM run command. + ) -> LROPoller[_models.VirtualMachineExtension]: + """The operation to update the extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. Is - either a VirtualMachineRunCommandUpdate type or a IO[bytes] type. Required. - :type run_command: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommandUpdate or - IO[bytes] - :return: An instance of LROPoller that returns either VirtualMachineRunCommand or the result of + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. Is either a VirtualMachineExtensionUpdate type or a IO[bytes] type. Required. + :type extension_parameters: + ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtensionUpdate or IO[bytes] + :return: An instance of LROPoller that returns either VirtualMachineExtension or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] + ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineExtension] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -28267,17 +29511,16 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineExtension] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._update_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - run_command=run_command, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -28289,30 +29532,37 @@ def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("VirtualMachineExtension", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualMachineRunCommand].from_continuation_token( + return LROPoller[_models.VirtualMachineExtension].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualMachineRunCommand]( + return LROPoller[_models.VirtualMachineExtension]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) def _delete_initial( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any + self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -28328,11 +29578,10 @@ def _delete_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_virtual_machine_scale_set_vm_run_commands_delete_request( + _request = build_virtual_machine_extensions_delete_request( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -28356,27 +29605,31 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace def begin_delete( - self, resource_group_name: str, vm_scale_set_name: str, instance_id: str, run_command_name: str, **kwargs: Any + self, resource_group_name: str, vm_name: str, vm_extension_name: str, **kwargs: Any ) -> LROPoller[None]: - """The operation to delete the VMSS VM run command. + """The operation to delete the extension. - :param resource_group_name: The name of the resource group. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str + :param vm_name: The name of the virtual machine. Required. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. Required. + :type vm_extension_name: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -28392,9 +29645,8 @@ def begin_delete( if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -28409,7 +29661,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -28422,171 +29676,3 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- deserialization_callback=get_long_running_output, ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - run_command_name: str, - *, - expand: Optional[str] = None, - **kwargs: Any - ) -> _models.VirtualMachineRunCommand: - """The operation to get the VMSS VM run command. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :param run_command_name: The name of the virtual machine run command. Required. - :type run_command_name: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: VirtualMachineRunCommand or the result of cls(response) - :rtype: ~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineRunCommand] = kwargs.pop("cls", None) - - _request = build_virtual_machine_scale_set_vm_run_commands_get_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - run_command_name=run_command_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachineRunCommand", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - vm_scale_set_name: str, - instance_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.VirtualMachineRunCommand"]: - """The operation to get all run commands of an instance in Virtual Machine Scaleset. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param vm_scale_set_name: The name of the VM scale set. Required. - :type vm_scale_set_name: str - :param instance_id: The instance ID of the virtual machine. Required. - :type instance_id: str - :keyword expand: The expand expression to apply on the operation. Default value is None. - :paramtype expand: str - :return: An iterator like instance of either VirtualMachineRunCommand or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2024_11_01.models.VirtualMachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-11-01")) - cls: ClsType[_models.VirtualMachineRunCommandsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_virtual_machine_scale_set_vm_run_commands_list_request( - resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachineRunCommandsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_compute_management_client.py index 0d0b931edf80..4d0906c2e78b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -52,7 +54,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-11-04". Note that overriding this default value may result in unsupported behavior. @@ -62,15 +64,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -89,7 +93,7 @@ def __init__( 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) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_metadata.json index 3c5000da56ef..db838149614d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_metadata.json @@ -5,13 +5,13 @@ "name": "ComputeManagementClient", "filename": "_compute_management_client", "description": "Compute Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_version.py index 8042a5e50f17..6ba690f28963 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "34.1.0" +VERSION = "35.0.0" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_compute_management_client.py index 906e76addcff..02853b5ae02c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/_compute_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -52,7 +54,7 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-11-04". Note that overriding this default value may result in unsupported behavior. @@ -62,15 +64,17 @@ class ComputeManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -89,7 +93,9 @@ def __init__( 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) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/_operations.py index 0f2f5cf59c24..2a1b148b39c2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/aio/operations/_operations.py @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_cloud_service_operating_systems_get_os_family_request, build_cloud_service_operating_systems_get_os_version_request, @@ -64,11 +66,8 @@ build_cloud_services_update_domain_walk_update_domain_request, build_cloud_services_update_request, ) +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,10 +86,10 @@ class CloudServiceRoleInstancesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_initial( @@ -830,10 +829,10 @@ class CloudServiceRolesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -994,10 +993,10 @@ class CloudServicesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_or_update_initial( @@ -2731,10 +2730,10 @@ class CloudServicesUpdateDomainOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _walk_update_domain_initial( @@ -3101,10 +3100,10 @@ class CloudServiceOperatingSystemsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/__init__.py index c38558c72df3..41713729b15f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/__init__.py @@ -63,6 +63,7 @@ SubResource, SubResourceReadOnly, SystemData, + SystemDataAutoGenerated, UpdateDomain, UpdateDomainListResult, UserAssignedIdentitiesValue, @@ -71,6 +72,7 @@ from ._compute_management_client_enums import ( # type: ignore CloudServiceSlotType, CloudServiceUpgradeMode, + CreatedByType, ExtendedLocationTypes, InstanceViewTypes, StatusLevelTypes, @@ -129,11 +131,13 @@ "SubResource", "SubResourceReadOnly", "SystemData", + "SystemDataAutoGenerated", "UpdateDomain", "UpdateDomainListResult", "UserAssignedIdentitiesValue", "CloudServiceSlotType", "CloudServiceUpgradeMode", + "CreatedByType", "ExtendedLocationTypes", "InstanceViewTypes", "StatusLevelTypes", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_compute_management_client_enums.py index 8447b6e04823..b046d41ecd72 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_compute_management_client_enums.py @@ -38,6 +38,15 @@ class CloudServiceUpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): SIMULTANEOUS = "Simultaneous" +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation.""" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_models_py3.py index 7c7b0dca974a..55b235800105 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/models/_models_py3.py @@ -7,19 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping +import datetime from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ApiError(_serialization.Model): @@ -128,7 +124,7 @@ class CloudService(_serialization.Model): :vartype tags: dict[str, str] :ivar properties: Cloud service properties. :vartype properties: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceProperties - :ivar system_data: The system meta data relating to this resource. + :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.compute.v2024_11_04.models.SystemData :ivar zones: List of logical availability zone of the resource. List should contain only 1 zone where cloud service should be provisioned. This field is optional. @@ -140,6 +136,7 @@ class CloudService(_serialization.Model): "name": {"readonly": True}, "type": {"readonly": True}, "location": {"required": True}, + "system_data": {"readonly": True}, } _attribute_map = { @@ -159,7 +156,6 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, properties: Optional["_models.CloudServiceProperties"] = None, - system_data: Optional["_models.SystemData"] = None, zones: Optional[List[str]] = None, **kwargs: Any ) -> None: @@ -170,20 +166,18 @@ def __init__( :paramtype tags: dict[str, str] :keyword properties: Cloud service properties. :paramtype properties: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceProperties - :keyword system_data: The system meta data relating to this resource. - :paramtype system_data: ~azure.mgmt.compute.v2024_11_04.models.SystemData :keyword zones: List of logical availability zone of the resource. List should contain only 1 zone where cloud service should be provisioned. This field is optional. :paramtype zones: list[str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags self.properties = properties - self.system_data = system_data + self.system_data: Optional["_models.SystemData"] = None self.zones = zones @@ -337,7 +331,7 @@ def __init__( self.protected_settings = protected_settings self.protected_settings_from_key_vault = protected_settings_from_key_vault self.force_update_tag = force_update_tag - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.roles_applied_to = roles_applied_to @@ -379,9 +373,9 @@ def __init__(self, *, role_instance: Optional["_models.InstanceViewStatusesSumma """ super().__init__(**kwargs) self.role_instance = role_instance - self.sdk_version = None - self.private_ids = None - self.statuses = None + self.sdk_version: Optional[str] = None + self.private_ids: Optional[List[str]] = None + self.statuses: Optional[List["_models.ResourceInstanceViewStatus"]] = None class CloudServiceListResult(_serialization.Model): @@ -642,8 +636,8 @@ def __init__( self.os_profile = os_profile self.network_profile = network_profile self.extension_profile = extension_profile - self.provisioning_state = None - self.unique_id = None + self.provisioning_state: Optional[str] = None + self.unique_id: Optional[str] = None class CloudServiceRole(_serialization.Model): @@ -695,10 +689,10 @@ def __init__( :paramtype properties: ~azure.mgmt.compute.v2024_11_04.models.CloudServiceRoleProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location: Optional[str] = None self.sku = sku self.properties = properties @@ -810,7 +804,7 @@ class CloudServiceRoleProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.unique_id = None + self.unique_id: Optional[str] = None class CloudServiceRoleSku(_serialization.Model): @@ -1089,8 +1083,8 @@ class InstanceSku(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.tier = None + self.name: Optional[str] = None + self.tier: Optional[str] = None class InstanceViewStatusesSummary(_serialization.Model): @@ -1113,7 +1107,7 @@ class InstanceViewStatusesSummary(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.statuses_summary = None + self.statuses_summary: Optional[List["_models.StatusCodeCount"]] = None class LoadBalancerConfiguration(_serialization.Model): @@ -1319,10 +1313,10 @@ def __init__(self, *, properties: Optional["_models.OSFamilyProperties"] = None, :paramtype properties: ~azure.mgmt.compute.v2024_11_04.models.OSFamilyProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location: Optional[str] = None self.properties = properties @@ -1388,9 +1382,9 @@ class OSFamilyProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.label = None - self.versions = None + self.name: Optional[str] = None + self.label: Optional[str] = None + self.versions: Optional[List["_models.OSVersionPropertiesBase"]] = None class OSVersion(_serialization.Model): @@ -1431,10 +1425,10 @@ def __init__(self, *, properties: Optional["_models.OSVersionProperties"] = None :paramtype properties: ~azure.mgmt.compute.v2024_11_04.models.OSVersionProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location: Optional[str] = None self.properties = properties @@ -1512,12 +1506,12 @@ class OSVersionProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.family = None - self.family_label = None - self.version = None - self.label = None - self.is_default = None - self.is_active = None + self.family: Optional[str] = None + self.family_label: Optional[str] = None + self.version: Optional[str] = None + self.label: Optional[str] = None + self.is_default: Optional[bool] = None + self.is_active: Optional[bool] = None class OSVersionPropertiesBase(_serialization.Model): @@ -1552,10 +1546,10 @@ class OSVersionPropertiesBase(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.version = None - self.label = None - self.is_default = None - self.is_active = None + self.version: Optional[str] = None + self.label: Optional[str] = None + self.is_default: Optional[bool] = None + self.is_active: Optional[bool] = None class Resource(_serialization.Model): @@ -1600,9 +1594,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1645,10 +1639,10 @@ def __init__(self, *, level: Optional[Union[str, "_models.StatusLevelTypes"]] = :paramtype level: str or ~azure.mgmt.compute.v2024_11_04.models.StatusLevelTypes """ super().__init__(**kwargs) - self.code = None - self.display_status = None - self.message = None - self.time = None + self.code: Optional[str] = None + self.display_status: Optional[str] = None + self.message: Optional[str] = None + self.time: Optional[datetime.datetime] = None self.level = level @@ -1692,9 +1686,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s """ super().__init__(**kwargs) self.location = location - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.tags = tags @@ -1751,11 +1745,11 @@ def __init__( :paramtype properties: ~azure.mgmt.compute.v2024_11_04.models.RoleInstanceProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location: Optional[str] = None + self.tags: Optional[Dict[str, str]] = None self.sku = sku self.properties = properties @@ -1815,7 +1809,7 @@ class RoleInstanceNetworkProfile(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.network_interfaces = None + self.network_interfaces: Optional[List["_models.SubResource"]] = None class RoleInstanceProperties(_serialization.Model): @@ -1912,10 +1906,10 @@ class RoleInstanceView(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.platform_update_domain = None - self.platform_fault_domain = None - self.private_id = None - self.statuses = None + self.platform_update_domain: Optional[int] = None + self.platform_fault_domain: Optional[int] = None + self.private_id: Optional[str] = None + self.statuses: Optional[List["_models.ResourceInstanceViewStatus"]] = None class StatusCodeCount(_serialization.Model): @@ -1942,8 +1936,8 @@ class StatusCodeCount(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.count = None + self.code: Optional[str] = None + self.count: Optional[int] = None class SubResource(_serialization.Model): @@ -1986,10 +1980,74 @@ class SubResourceReadOnly(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.compute.v2024_11_04.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.compute.v2024_11_04.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.compute.v2024_11_04.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.compute.v2024_11_04.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class SystemDataAutoGenerated(_serialization.Model): """The system meta data relating to this resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2015,8 +2073,8 @@ class SystemData(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.created_at = None - self.last_modified_at = None + self.created_at: Optional[datetime.datetime] = None + self.last_modified_at: Optional[datetime.datetime] = None class UpdateDomain(_serialization.Model): @@ -2043,8 +2101,8 @@ class UpdateDomain(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None + self.id: Optional[str] = None + self.name: Optional[str] = None class UpdateDomainListResult(_serialization.Model): @@ -2105,5 +2163,5 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/_operations.py index 48e68f9fb9c9..1177801803f9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2024_11_04/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ComputeManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +55,7 @@ def build_cloud_service_role_instances_delete_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -95,7 +93,7 @@ def build_cloud_service_role_instances_get_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -129,7 +127,7 @@ def build_cloud_service_role_instances_get_instance_view_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -166,7 +164,7 @@ def build_cloud_service_role_instances_list_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -199,7 +197,7 @@ def build_cloud_service_role_instances_restart_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -231,7 +229,7 @@ def build_cloud_service_role_instances_reimage_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -263,7 +261,7 @@ def build_cloud_service_role_instances_rebuild_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -295,7 +293,7 @@ def build_cloud_service_role_instances_get_remote_desktop_file_request( # pylin _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -327,7 +325,7 @@ def build_cloud_service_roles_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "roleName": _SERIALIZER.url("role_name", role_name, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -359,7 +357,7 @@ def build_cloud_service_roles_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -391,7 +389,7 @@ def build_cloud_services_create_or_update_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -425,7 +423,7 @@ def build_cloud_services_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -458,7 +456,7 @@ def build_cloud_services_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -489,7 +487,7 @@ def build_cloud_services_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -520,7 +518,7 @@ def build_cloud_services_get_instance_view_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -573,7 +571,7 @@ def build_cloud_services_list_request(resource_group_name: str, subscription_id: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -603,7 +601,7 @@ def build_cloud_services_start_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -634,7 +632,7 @@ def build_cloud_services_power_off_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -666,7 +664,7 @@ def build_cloud_services_restart_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -700,7 +698,7 @@ def build_cloud_services_reimage_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -734,7 +732,7 @@ def build_cloud_services_rebuild_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -768,7 +766,7 @@ def build_cloud_services_delete_instances_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -802,7 +800,7 @@ def build_cloud_services_update_domain_walk_update_domain_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -836,7 +834,7 @@ def build_cloud_services_update_domain_get_update_domain_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -868,7 +866,7 @@ def build_cloud_services_update_domain_list_update_domains_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, "str"), @@ -899,7 +897,7 @@ def build_cloud_service_operating_systems_get_os_version_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "osVersionName": _SERIALIZER.url("os_version_name", os_version_name, "str"), @@ -930,7 +928,7 @@ def build_cloud_service_operating_systems_list_os_versions_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -960,7 +958,7 @@ def build_cloud_service_operating_systems_get_os_family_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "osFamilyName": _SERIALIZER.url("os_family_name", os_family_name, "str"), @@ -991,7 +989,7 @@ def build_cloud_service_operating_systems_list_os_families_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1022,10 +1020,10 @@ class CloudServiceRoleInstancesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_initial( @@ -1764,10 +1762,10 @@ class CloudServiceRolesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1927,10 +1925,10 @@ class CloudServicesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_or_update_initial( @@ -3650,10 +3648,10 @@ class CloudServicesUpdateDomainOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _walk_update_domain_initial( @@ -4019,10 +4017,10 @@ class CloudServiceOperatingSystemsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ComputeManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_cancel_migration_to_virtual_machine_scale_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_cancel_migration_to_virtual_machine_scale_set.py index c4b6294bdcc6..ab11d4557ec0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_cancel_migration_to_virtual_machine_scale_set.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_cancel_migration_to_virtual_machine_scale_set.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_convert_to_virtual_machine_scale_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_convert_to_virtual_machine_scale_set.py index b153dd56ef24..ce6549f438e2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_convert_to_virtual_machine_scale_set.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_convert_to_virtual_machine_scale_set.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create.py index d8cddc806e9c..2ecd42711826 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create_with_scheduled_event_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create_with_scheduled_event_profile.py index 107562b099a8..78ef71cf7015 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create_with_scheduled_event_profile.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_create_with_scheduled_event_profile.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_maximum_set_gen.py index 4de69ead34ec..1579d1e5d7eb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_minimum_set_gen.py index b744ed34f00f..1cd164cbabd3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_maximum_set_gen.py index 0368fd9e4898..04299e6cddc9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_minimum_set_gen.py index cf555a5be3eb..0c0fe571d61d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_maximum_set_gen.py index 9caccf0c4df2..e9571bc03673 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_minimum_set_gen.py index 3622658323a2..41aa29b0457d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_available_sizes_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_by_subscription.py index 054533c08d18..494a6501497c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_by_subscription.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_maximum_set_gen.py index 347967a3e7ef..bf573138d52a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_minimum_set_gen.py index f32bd94f6863..24f0e87b8d1c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_start_migration_to_virtual_machine_scale_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_start_migration_to_virtual_machine_scale_set.py index 66ec55f893ec..adeaf0b9dbaa 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_start_migration_to_virtual_machine_scale_set.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_start_migration_to_virtual_machine_scale_set.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_update_maximum_set_gen.py index b5e21f90f144..25c715742856 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_update_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_validate_migration_to_virtual_machine_scale_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_validate_migration_to_virtual_machine_scale_set.py index 119b0c896568..0cad975311d3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_validate_migration_to_virtual_machine_scale_set.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/availability_set_examples/availability_set_validate_migration_to_virtual_machine_scale_set.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_create_or_update.py index 8b84586c1a05..9e7444406d31 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_create_or_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_maximum_set_gen.py index 9181daba8ced..57c4134cb49d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_minimum_set_gen.py index 34d37485319a..bbdcdfc21724 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_get.py index da95500d5d9c..799be668a6cf 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_create_or_update.py index ca906bcf8668..b563b9608876 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_create_or_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_maximum_set_gen.py index 5df72f9cf22a..a1650b8fabeb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_minimum_set_gen.py index 42730a7d80fb..8977938584b4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_get.py index f6768370d820..b80a19be775f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_resource_group.py index ec89c4dec63d..3d308879c9d6 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_resource_group.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription.py index a8b5c1cc4c08..826b69bff6c7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription_with_resource_ids_query.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription_with_resource_ids_query.py index 907060c897fe..e88f12c11322 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription_with_resource_ids_query.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_list_by_subscription_with_resource_ids_query.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_update_maximum_set_gen.py index d8a6480e75d0..c4e33c91bbaa 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_update_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_group_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_list_by_reservation_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_list_by_reservation_group.py index 1abb1318997b..d0f4de1f85af 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_list_by_reservation_group.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_list_by_reservation_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_update_maximum_set_gen.py index 6c1efa4c43a6..11ac26f38df5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_update_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/capacity_reservation_examples/capacity_reservation_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_maximum_set_gen.py index 0b5a873c77af..9a4a2bb9076c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_minimum_set_gen.py index 8275dd46c9cb..232ab25207ab 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/operations_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_maximum_set_gen.py index 04ebd0d23921..febd87a9c300 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_minimum_set_gen.py index 845c4e4989a2..fb4f77af5bdd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/usage_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_maximum_set_gen.py index f7a554a5b674..a11a8fb3669d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_minimum_set_gen.py index 2652cd5afee1..f3f526e7e478 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/compute_rp_common_examples/virtual_machine_sizes_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_create_or_update.py index 0cdf4103dd82..ee722a15bd25 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_create_or_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_maximum_set_gen.py index f4a831167e04..0e42baaec316 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_minimum_set_gen.py index b62ff4e4e5d2..0c1d3578862a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_get.py index 3e0920139cab..08f0b7aa80e9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update.py index 4b4fd71c7f67..14c4d0421eb1 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update_with_ultra_ssd.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update_with_ultra_ssd.py index 541c1350677e..ba8651031f14 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update_with_ultra_ssd.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_create_or_update_with_ultra_ssd.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_maximum_set_gen.py index 8664137669c5..118dd0c3b2cb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_minimum_set_gen.py index f7d39910121f..9c187ca2a6ef 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get.py index 448dcf5ad34f..9b7b28e73c51 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get_ultra_ssd_enabled_dedicated_host_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get_ultra_ssd_enabled_dedicated_host_group.py index 4ba4d9943ae2..fd0d8f87a2f9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get_ultra_ssd_enabled_dedicated_host_group.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_get_ultra_ssd_enabled_dedicated_host_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_maximum_set_gen.py index f07bbedaf140..03091e14bcec 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_minimum_set_gen.py index 6376762f59f1..b90fb5ff96c4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_resource_group_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_maximum_set_gen.py index ffd65ca6fba0..6b07c7e64202 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_minimum_set_gen.py index 4f4a828b3100..539e81f83409 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_list_by_subscription_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_update_maximum_set_gen.py index 5af28d12da78..5d2a855cb45b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_update_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_group_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_available_sizes.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_available_sizes.py index 06a3e7ec5f0e..ee66f2604f98 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_available_sizes.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_available_sizes.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_maximum_set_gen.py index 2ea660fff4cd..5a40535d0216 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_minimum_set_gen.py index 5ef4044cb671..4992ad5b317e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_list_by_host_group_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_redeploy.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_redeploy.py index 3c569eb8bd70..c196849bb97a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_redeploy.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_redeploy.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_restart.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_restart.py index 468481ff9329..752f3641132e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_restart.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_restart.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_maximum_set_gen.py index 7c399b28cffb..a974ea70ebe4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_resize.py b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_resize.py index b7bfd49df62a..28ce08a2c505 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_resize.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/dedicated_host_examples/dedicated_host_update_resize.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_ablob_included.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_ablob_included.py index 0b741046991a..9079d73d4ff8 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_ablob_included.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_ablob_included.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_amanaged_disk_included.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_amanaged_disk_included.py index d95b6f8638e7..c02a180c3046 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_amanaged_disk_included.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_amanaged_disk_included.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_asnapshot_included.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_asnapshot_included.py index 8feb94b998f5..eafa589a5ed2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_asnapshot_included.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_data_disk_from_asnapshot_included.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob.py index 91976250796c..397280da43ea 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob_with_disk_encryption_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob_with_disk_encryption_set.py index f9c117bbbbc6..2f7a368f353c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob_with_disk_encryption_set.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_ablob_with_disk_encryption_set.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk.py index 1d52ae98a033..6f2d26ab641d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk_with_disk_encryption_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk_with_disk_encryption_set.py index 3864a874af0b..475a29d7878d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk_with_disk_encryption_set.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_amanaged_disk_with_disk_encryption_set.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot.py index c04b733228ec..5a8329080e8b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot_with_disk_encryption_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot_with_disk_encryption_set.py index bf22c4aed38b..a8abbaaa9e19 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot_with_disk_encryption_set.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_asnapshot_with_disk_encryption_set.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_avm.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_avm.py index d55c234dbc47..3a7002f962bd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_avm.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_create_from_avm.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_get.py index 014d3d5c768d..0553d57c3e67 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_resource_group.py index 1b90da45f857..cf5d1183b494 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_resource_group.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_subscription.py index 8d525e3bf054..2ba65d53eab3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_subscription.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_list_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_update.py index 9d9c3ae7f3fb..465426a4e373 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/image_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_maximum_set_gen.py index 057d4ec8cbf4..4bd3d2d75771 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_minimum_set_gen.py index 8ccc2ab64b6f..ddb01913731e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/image_examples/images_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_request_rate_by_interval.py b/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_request_rate_by_interval.py index 3cf7ca800576..4581ea1269db 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_request_rate_by_interval.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_request_rate_by_interval.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_throttled_requests.py b/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_throttled_requests.py index 9bc4526217e3..f0620e7ca6d3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_throttled_requests.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/log_analytic_examples/log_analytics_throttled_requests.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_create_or_update.py index f2f5b9d6b742..6cebe92ebe0e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_create_or_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_delete.py index 8e57485780a3..d47db17df306 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_delete.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_get.py index 4dd5042a7aff..98dcf9484116 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_resource_group.py index b7f38760540f..d2d8b7fa3fde 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_resource_group.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_subscription.py index 8d172f7d92bb..dba807e6282e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_subscription.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_list_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_patch.py b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_patch.py index f7920db7ca7e..7265ebcb565e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_patch.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/proximity_placement_group_examples/proximity_placement_group_patch.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update.py index 1e586ccf7a7c..9688b08631ba 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update_for_cross_region_copy.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update_for_cross_region_copy.py index 3947b550194d..5a26a33e42e1 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update_for_cross_region_copy.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_create_or_update_for_cross_region_copy.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_maximum_set_gen.py index 983b04b30f6c..859b595fccc2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_minimum_set_gen.py index 6b2bd19840d5..6f6b03a024a0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get.py index e85015cad830..bf1a0a1e5fdd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get_with_contained_restore_points.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get_with_contained_restore_points.py index 66daad95a5d7..f7112cd0e925 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get_with_contained_restore_points.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_get_with_contained_restore_points.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_resource_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_resource_group.py index 396298affa4c..cb8b13064440 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_resource_group.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_subscription.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_subscription.py index a92212b6d34f..43f811223302 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_subscription.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_list_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_update_maximum_set_gen.py index a112a084fbc4..cb38bf0dca13 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_update_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_collection_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_copy_between_regions.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_copy_between_regions.py index bcdddd8de00c..7a2ed6a9ff0d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_copy_between_regions.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_copy_between_regions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_create.py index 23428515713c..41f10786fc6a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_create.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_create.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_maximum_set_gen.py index a6edf691ac9c..df94480e63eb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_minimum_set_gen.py index c50ee5cf95eb..d228d6cd223a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get.py index ddaa1de6efa2..97baf03f45dc 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get_with_instance_view.py b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get_with_instance_view.py index 45c1661c492e..300747c2a6ee 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get_with_instance_view.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/restore_point_examples/restore_point_get_with_instance_view.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_get.py index 5a980711efe9..00680e1c32d3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_list.py index e7ca0fe3e54a..ec87996a7dea 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_list.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/run_command_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command.py index e617a3cff77e..c253b21039c4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_create_or_update.py index 54f68fa989ab..891a357205f5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_create_or_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_delete.py index 498a92a54696..c524c1cddbd0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_delete.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_get.py index 62f75f477560..9ff0393b6867 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_list.py index 5e1f5035d3b2..baedf6aae52f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_list.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_update.py index 57b1efe4f6e5..fd73f051be2e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_run_command_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command.py index 621e826e092d..501d5df1287b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_create_or_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_create_or_update.py index 98a09d840ce5..4f1c11d8b5a4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_create_or_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_delete.py index 2b007e4dd4f1..d2a360787cf4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_delete.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_get.py index cff858005bd9..9aec45094495 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_list.py index 40b39012eb01..efab8661df13 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_list.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_update.py index 1ad30e25a1d8..2e0a4b714eaa 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/run_command_examples/virtual_machine_scale_set_vm_run_command_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_create.py index 14e9d8fbc6c0..151071268471 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_create.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_create.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_maximum_set_gen.py index 398ae7253f31..dc04008c0ba8 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_minimum_set_gen.py index a87da83fa1c5..9b5a8370af35 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair.py index c1f10e16fe61..93ee8843743e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_ed25519.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_ed25519.py index a9a0f622fba5..3dc37fe43084 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_ed25519.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_ed25519.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_rsa.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_rsa.py index 5758b6616631..1b7f67de1b83 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_rsa.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_generate_key_pair_encryption_with_rsa.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_get.py index a13689019dee..e0b5f5ea418f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_maximum_set_gen.py index 4de87311e667..46906edee04b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_minimum_set_gen.py index a2e71bfe322f..8a4e80e4805f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_resource_group_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_maximum_set_gen.py index f926a0f31e66..ef95e306f4bc 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_minimum_set_gen.py index 4819f56d21e4..13c0d21c57a6 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_list_by_subscription_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_update_maximum_set_gen.py index e034b5e3faa5..99797a132b5c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_update_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/ssh_public_key_examples/ssh_public_key_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_assess_patches.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_assess_patches.py index f2e8248f6e24..e3a3105f19df 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_assess_patches.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_assess_patches.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_maximum_set_gen.py index 6b24406fdaef..2526ce7ea7fa 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_minimum_set_gen.py index 806f727dcf2b..2a61d5a13a9a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_attach_detach_data_disks_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_maximum_set_gen.py index 189e36f6bc94..56500ce591ed 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_minimum_set_gen.py index bb1dc39a096d..dcf27a683eca 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_capture_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_maximum_set_gen.py index 14c24c8455df..2fade1a5e0df 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_minimum_set_gen.py index ce371014e6dc..273ef38d4fbb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_convert_to_managed_disks_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_custom_image_vm_from_an_unmanaged_generalized_os_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_custom_image_vm_from_an_unmanaged_generalized_os_image.py index 74e3f318c1f1..f86cc4614d1f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_custom_image_vm_from_an_unmanaged_generalized_os_image.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_custom_image_vm_from_an_unmanaged_generalized_os_image.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acommunity_gallery_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acommunity_gallery_image.py index 87c6a3ff2d11..b08c11f3f793 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acommunity_gallery_image.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acommunity_gallery_image.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acustom_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acustom_image.py index 0f98e7517a85..c282fd79ebff 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acustom_image.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_acustom_image.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ageneralized_shared_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ageneralized_shared_image.py index 1c7545f43120..db10cf69e72c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ageneralized_shared_image.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ageneralized_shared_image.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ashared_gallery_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ashared_gallery_image.py index ee321af77660..a42627b87bd9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ashared_gallery_image.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_ashared_gallery_image.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_aspecialized_shared_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_aspecialized_shared_image.py index 07757f0f0722..a4864446c718 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_aspecialized_shared_image.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_from_aspecialized_shared_image.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_an_availability_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_an_availability_set.py index 06b49d3f203f..7d4f88d665ed 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_an_availability_set.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_an_availability_set.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_avmss_with_customer_assigned_platform_fault_domain.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_avmss_with_customer_assigned_platform_fault_domain.py index bfe278b1d3ae..992286c0be45 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_avmss_with_customer_assigned_platform_fault_domain.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_in_avmss_with_customer_assigned_platform_fault_domain.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_automatic_by_platform_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_automatic_by_platform_settings.py index 66cef70edf54..cfbb8ecf44c1 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_automatic_by_platform_settings.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_automatic_by_platform_settings.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_assessment_mode_of_image_default.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_assessment_mode_of_image_default.py index 4cffbe9543db..ad27073938bb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_assessment_mode_of_image_default.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_assessment_mode_of_image_default.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_mode_of_image_default.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_mode_of_image_default.py index 3559331fedcb..27e69771a3ca 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_mode_of_image_default.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_mode_of_image_default.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_modes_of_automatic_by_platform.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_modes_of_automatic_by_platform.py index 445a2b095dfd..e8990bfa8ebd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_modes_of_automatic_by_platform.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_linux_vm_with_patch_setting_modes_of_automatic_by_platform.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_platform_image_vm_with_unmanaged_os_and_data_disks.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_platform_image_vm_with_unmanaged_os_and_data_disks.py index ef192f2cfb2a..5462f71d6bf0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_platform_image_vm_with_unmanaged_os_and_data_disks.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_platform_image_vm_with_unmanaged_os_and_data_disks.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_automatic_by_platform_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_automatic_by_platform_settings.py index 4eae0afbec9c..d1afd5f3a8d5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_automatic_by_platform_settings.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_automatic_by_platform_settings.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_assessment_mode_of_image_default.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_assessment_mode_of_image_default.py index 02d7838458a9..0688037a92b1 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_assessment_mode_of_image_default.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_assessment_mode_of_image_default.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_os.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_os.py index 6e70c2c39c47..7b67a79606fa 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_os.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_os.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_platform_and_enable_hot_patching_true.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_platform_and_enable_hot_patching_true.py index d4977ab8df4e..55babfdfa0e7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_platform_and_enable_hot_patching_true.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_platform_and_enable_hot_patching_true.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_manual.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_manual.py index 5b761afc4506..7242e24274a3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_manual.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_mode_of_manual.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_modes_of_automatic_by_platform.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_modes_of_automatic_by_platform.py index e96213c3aacb..cbba93bc78bb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_modes_of_automatic_by_platform.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_windows_vm_with_patch_setting_modes_of_automatic_by_platform.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk.py index cf6dcad02048..76ec16096c8b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_cache_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_cache_disk.py index b89e073f4501..3c3ddf3c76d4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_cache_disk.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_cache_disk.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_nvme_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_nvme_disk.py index ecbfa90b8b6f..9bfa0ab9e794 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_nvme_disk.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_nvme_disk.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_resource_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_resource_disk.py index 4a8edb525a9d..d6a6dc2c18e6 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_resource_disk.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_resource_disk.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_amarketplace_image_plan.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_amarketplace_image_plan.py index f4f827db6524..d0d1b1591581 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_amarketplace_image_plan.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_amarketplace_image_plan.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_application_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_application_profile.py index 24c940dcbad7..ec6606b5ac1a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_application_profile.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_application_profile.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_boot_diagnostics.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_boot_diagnostics.py index 6e21375b557e..812debf67a7d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_boot_diagnostics.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_boot_diagnostics.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_capacity_reservation.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_capacity_reservation.py index 6ba95e5bab9f..36287b9df067 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_capacity_reservation.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_capacity_reservation.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_data_disks_from_source_resource.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_data_disks_from_source_resource.py index 964a799b2edc..1441e8ac46f2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_data_disks_from_source_resource.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_data_disks_from_source_resource.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_controller_type.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_controller_type.py index 8dfc649e15e8..b598922f43c1 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_controller_type.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_controller_type.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_encryption_set_resource.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_encryption_set_resource.py index 8429c1162a81..2ea8ccfbda8b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_encryption_set_resource.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_disk_encryption_set_resource.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_empty_data_disks.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_empty_data_disks.py index 5df6c8fa6805..189cfc4852a7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_empty_data_disks.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_empty_data_disks.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_at_host.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_at_host.py index 414816298c91..d9bb4ff54f37 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_at_host.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_at_host.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_identity.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_identity.py index 77afe244a80f..c843f83a042c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_identity.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_encryption_identity.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_extensions_time_budget.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_extensions_time_budget.py index 5e4b605c5df5..2b33c8c5867a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_extensions_time_budget.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_extensions_time_budget.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_hibernation_enabled.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_hibernation_enabled.py index d8b4205b9960..4468d30f6510 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_hibernation_enabled.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_hibernation_enabled.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_managed_boot_diagnostics.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_managed_boot_diagnostics.py index 9ce8ab3950a7..52c94e0b63df 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_managed_boot_diagnostics.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_managed_boot_diagnostics.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration.py index f1925033ef7e..585c2d62d60a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration_dns_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration_dns_settings.py index 675f6e60f872..751a7b579d8c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration_dns_settings.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_network_interface_configuration_dns_settings.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_password_authentication.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_password_authentication.py index 733ae578a919..9c34c02f5a13 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_password_authentication.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_password_authentication.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_placement.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_placement.py index 70a089e9d31f..c01fc47a73d4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_placement.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_placement.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_premium_storage.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_premium_storage.py index 4e0a660082b2..07b628bfb3c7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_premium_storage.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_premium_storage.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_proxy_agent_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_proxy_agent_settings.py index 3dfc933c3193..8850135c99bd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_proxy_agent_settings.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_proxy_agent_settings.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_scheduled_events_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_scheduled_events_profile.py index 3a38d448440a..c22742914436 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_scheduled_events_profile.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_scheduled_events_profile.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm.py index 4793eb7ce762..56cd8c3a41bc 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_customer_managed_keys.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_customer_managed_keys.py index eed3da5db370..303102e63141 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_customer_managed_keys.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_customer_managed_keys.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_non_persisted_tpm.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_non_persisted_tpm.py index 2a670618b9cd..b32ecaefe6c2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_non_persisted_tpm.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_security_type_confidential_vm_with_non_persisted_tpm.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_ssh_authentication.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_ssh_authentication.py index 8d8356de4cbf..3ff42db2449d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_ssh_authentication.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_ssh_authentication.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_uefi_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_uefi_settings.py index 317470b1ddb3..35e7fbe87f94 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_uefi_settings.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_uefi_settings.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_user_data.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_user_data.py index 4f25d9c046a2..f588025cc8c7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_user_data.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_user_data.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_vm_size_properties.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_vm_size_properties.py index e17f914433cf..fd1d800341ea 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_vm_size_properties.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_create_with_vm_size_properties.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_maximum_set_gen.py index 0aa916b7068b..53722c7104f4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_minimum_set_gen.py index a717499cb329..3123a76a1164 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_deallocate_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_delete_force.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_delete_force.py index 6cc1a8ac8133..17d9991c7f0f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_delete_force.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_delete_force.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_maximum_set_gen.py index 0977b3849430..19c1940d1a0a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_minimum_set_gen.py index 3aabcdadbe70..32cfc4e97fe1 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_create_or_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_maximum_set_gen.py index a5bf0502f81d..b11aaa82c9af 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_minimum_set_gen.py index 9c9ae37241cf..7218d468a8c8 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_maximum_set_gen.py index 46cb7a594ebe..85c0acf315c5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_minimum_set_gen.py index defa371928d5..774677375088 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_maximum_set_gen.py index 82f27deb8228..6352ed1ceb24 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_minimum_set_gen.py index 6ce9c2da04f6..9db0d96cbb1a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_update.py index 8aa2594af0a0..8bb59642e27a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_extension_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_generalize.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_generalize.py index 65368aaf50bb..80cefa41d737 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_generalize.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_generalize.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get.py index e06e8202ea5f..01e9a4764dfa 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_auto_placed_on_dedicated_host_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_auto_placed_on_dedicated_host_group.py index 3db7ad1479d5..7f5a3e6f4cdf 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_auto_placed_on_dedicated_host_group.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_auto_placed_on_dedicated_host_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view.py index b0deed272e71..a2ae0effb179 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view_auto_placed_on_dedicated_host_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view_auto_placed_on_dedicated_host_group.py index 5464c1d0cefc..157d9ad64ee5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view_auto_placed_on_dedicated_host_group.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_instance_view_auto_placed_on_dedicated_host_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_disk_controller_type.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_disk_controller_type.py index 8d5dfea8b206..53413ae262d4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_disk_controller_type.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_disk_controller_type.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_vm_size_properties.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_vm_size_properties.py index c9be8608e456..26e3a756eae0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_vm_size_properties.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_get_with_vm_size_properties.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_install_patches.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_install_patches.py index 9c81441387ba..2daf69087070 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_install_patches.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_install_patches.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_maximum_set_gen.py index 30b5aa9ee9f4..de2c7e0d04d0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_minimum_set_gen.py index 3fa944e5e48e..ee691616d8b7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_all_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_available_vm_sizes.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_available_vm_sizes.py index 4867e1a393f1..1bef0afa81ec 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_available_vm_sizes.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_available_vm_sizes.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_by_subscription_by_location.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_by_subscription_by_location.py index 1e5168a3d0d6..1216e38e3ccc 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_by_subscription_by_location.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_by_subscription_by_location.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_maximum_set_gen.py index 3777a5a7d7ca..85b052616042 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_minimum_set_gen.py index c9975ba5cea6..e91a13a91282 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_migrate_to_virtual_machine_scale_set.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_migrate_to_virtual_machine_scale_set.py index 718f26411825..e40ac9280266 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_migrate_to_virtual_machine_scale_set.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_migrate_to_virtual_machine_scale_set.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_maximum_set_gen.py index 324f7ec9c942..e36d2ef38e08 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_minimum_set_gen.py index 52d75e8375ff..9199a8c5adfc 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_perform_maintenance_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_maximum_set_gen.py index 7e24a20d980b..ae5edde632b7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_minimum_set_gen.py index 5d2beaaffa73..27b5204f2e3d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_power_off_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reapply.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reapply.py index 28721814cb4d..75b6fdffc9ce 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reapply.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reapply.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_maximum_set_gen.py index 88407bad600c..1e9cd696626e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_minimum_set_gen.py index 3c57b18a6c8b..64d0c474a18d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_redeploy_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage.py index 044157d335f1..d8691a9f7553 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage_non_ephemeral_vms.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage_non_ephemeral_vms.py index 347f695237bb..970f48ad5768 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage_non_ephemeral_vms.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_reimage_non_ephemeral_vms.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_maximum_set_gen.py index 475ae95a72d7..3fd50cac4f1f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_minimum_set_gen.py index 1a1a8f899086..53672fe5806e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_restart_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_retrieve_boot_diagnostics_data.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_retrieve_boot_diagnostics_data.py index fadd36242d6a..d693950fb17b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_retrieve_boot_diagnostics_data.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_retrieve_boot_diagnostics_data.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_simulate_eviction.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_simulate_eviction.py index e235aac872df..96cdd9eaf058 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_simulate_eviction.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_simulate_eviction.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_maximum_set_gen.py index c25a1d695b57..9cd5ae176788 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_minimum_set_gen.py index 1e115ae41d2e..f357045c3cd5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_start_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_detach_data_disk_using_to_be_detached_property.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_detach_data_disk_using_to_be_detached_property.py index f0d35fb9822f..2c3ef95e4480 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_detach_data_disk_using_to_be_detached_property.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_detach_data_disk_using_to_be_detached_property.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_force_detach_data_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_force_detach_data_disk.py index 5b4846b47d27..a15be289c87c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_force_detach_data_disk.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_examples/virtual_machine_update_force_detach_data_disk.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_maximum_set_gen.py index 105347015c55..19efc025c1be 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_minimum_set_gen.py index 6db5a7aa8bb5..52e7b82785a7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_maximum_set_gen.py index b18abf410d44..33583443e077 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_minimum_set_gen.py index 071518b300ae..2b2e961e6ba6 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_types_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_maximum_set_gen.py index 8672c86d23b6..16f601b26e0b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_minimum_set_gen.py index 77931c30c802..0051c54c6333 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_extension_image_examples/virtual_machine_extension_image_list_versions_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_maximum_set_gen.py index bc5079d623f9..a057d8be98c0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_minimum_set_gen.py index 3f70f579b638..66ae21c1060d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_maximum_set_gen.py index a534071228bc..420bf3d7195d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_minimum_set_gen.py index 053e6eebc6d1..b10122e21066 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_maximum_set_gen.py index cd827439d6fd..80de42528e8e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_minimum_set_gen.py index f8cb538ac1bf..737b1ea6a704 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_offers_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_maximum_set_gen.py index def06b4f5ce3..20a76637280f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_minimum_set_gen.py index 1f61a3f03399..d7fa537d2970 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_publishers_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_maximum_set_gen.py index 0def4604737b..e7034c7eb5e0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_minimum_set_gen.py index f2ef3db07ba5..a05c02a52c14 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_image_list_skus_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_maximum_set_gen.py index 6772062f579f..205131cfd087 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_minimum_set_gen.py index 677b80c867e6..28c8627cd18d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_maximum_set_gen.py index 72fa5d15aa00..94dc3af69b19 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_minimum_set_gen.py index 3be3186d1d53..5b21973a1c50 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_by_edge_zone_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_maximum_set_gen.py index 9ca82831274c..0727210c6446 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_minimum_set_gen.py index cbc71c459563..486da1c02d51 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_maximum_set_gen.py index 46a5ebc543e2..fb4fd677733b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_minimum_set_gen.py index 6df669dace09..00819c3b8d8e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_offers_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_maximum_set_gen.py index 4e2bac5178fb..1d3dac9fe56c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_minimum_set_gen.py index 92926d1f877f..238e3ba252d9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_publishers_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_maximum_set_gen.py index 70d4822c4ea0..e73edf4ff9c4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_minimum_set_gen.py index c4a9d823ff14..6e2285aaf817 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_edge_zone_list_skus_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_maximum_set_gen.py index 2d4fc45cdfc3..9502f11cf55f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_minimum_set_gen.py index fcd10aba20ca..2adb80bec418 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_image_examples/virtual_machine_images_list_with_properties_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_approve_rolling_upgrade.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_approve_rolling_upgrade.py index 958bf4bef9b0..ce101599c5a8 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_approve_rolling_upgrade.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_approve_rolling_upgrade.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_convert_to_single_placement_group_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_convert_to_single_placement_group_maximum_set_gen.py index daa5835e9003..1d728b6f61f2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_convert_to_single_placement_group_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_convert_to_single_placement_group_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement.py index d73303abfb54..0dfb483588e7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement_as_nvme_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement_as_nvme_disk.py index 3e12dc5f91be..5fc2a9e7f1c3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement_as_nvme_disk.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement_as_nvme_disk.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_custom_image_from_an_unmanaged_generalized_os_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_custom_image_from_an_unmanaged_generalized_os_image.py index 0e3ba73e090a..3d86b164a473 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_custom_image_from_an_unmanaged_generalized_os_image.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_custom_image_from_an_unmanaged_generalized_os_image.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_acustom_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_acustom_image.py index 89aeee63a45f..9c47baee5ce8 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_acustom_image.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_acustom_image.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_ageneralized_shared_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_ageneralized_shared_image.py index 470706bfae43..1b9ef520fb45 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_ageneralized_shared_image.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_ageneralized_shared_image.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_aspecialized_shared_image.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_aspecialized_shared_image.py index 36b760cb4477..9f774108c7e4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_aspecialized_shared_image.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_aspecialized_shared_image.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_disable_tcp_state_tracking_network_interface.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_disable_tcp_state_tracking_network_interface.py index f67e48915eec..3be0c7398dd3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_disable_tcp_state_tracking_network_interface.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_disable_tcp_state_tracking_network_interface.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_fpga_network_interface.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_fpga_network_interface.py index 8c4319c1ee30..48db657cb246 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_fpga_network_interface.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_fpga_network_interface.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_network_interface_with_dns_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_network_interface_with_dns_settings.py index acc65e6ce2d5..5d4b73a01272 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_network_interface_with_dns_settings.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_from_with_network_interface_with_dns_settings.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_platform_image_with_unmanaged_os_disks.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_platform_image_with_unmanaged_os_disks.py index d0cbc95e1248..0c362024246f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_platform_image_with_unmanaged_os_disks.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_platform_image_with_unmanaged_os_disks.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_amarketplace_image_plan.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_amarketplace_image_plan.py index f6383666bdc8..8ecc89b508bf 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_amarketplace_image_plan.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_amarketplace_image_plan.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_application_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_application_profile.py index 557d8897c9a6..aeaeeabd648f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_application_profile.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_application_profile.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_repairs.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_repairs.py index 5e3262ecb4f2..91efc203758d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_repairs.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_repairs.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_zone_rebalancing_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_zone_rebalancing_policy.py index 891cee6d124a..13d5d27388c5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_zone_rebalancing_policy.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_automatic_zone_rebalancing_policy.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_application_gateway.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_application_gateway.py index 7666b3dcd6a4..8852730807fe 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_application_gateway.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_application_gateway.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_load_balancer.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_load_balancer.py index e1246caa6973..8f81fd88bd69 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_load_balancer.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_azure_load_balancer.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_boot_diagnostics.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_boot_diagnostics.py index d4b3b92208d1..392c530ba486 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_boot_diagnostics.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_boot_diagnostics.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_capacity_reservation.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_capacity_reservation.py index 4b84a6de44af..1bbaf39cf6fd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_capacity_reservation.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_capacity_reservation.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_diff_os_disk.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_diff_os_disk.py index 8556ca977376..8de3fd65e17b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_diff_os_disk.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_diff_os_disk.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_controller_type.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_controller_type.py index c3c792474cca..8a117b5cc606 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_controller_type.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_controller_type.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_encryption_set_resource.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_encryption_set_resource.py index 0cbd95f9b076..6aa61fb660ea 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_encryption_set_resource.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_disk_encryption_set_resource.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_empty_data_disks_on_each_vm.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_empty_data_disks_on_each_vm.py index 9e30fe7b9516..78725816f193 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_empty_data_disks_on_each_vm.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_empty_data_disks_on_each_vm.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_encryption_at_host.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_encryption_at_host.py index 5faa1ff1c324..533e47545db9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_encryption_at_host.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_encryption_at_host.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_suppress_failures_enabled.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_suppress_failures_enabled.py index 832ffe13c2ff..d572b1b07899 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_suppress_failures_enabled.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_suppress_failures_enabled.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_time_budget.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_time_budget.py index ca42aeed6312..7aa937eb169c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_time_budget.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_extensions_time_budget.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_managed_boot_diagnostics.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_managed_boot_diagnostics.py index c05e4a50a1a9..07a494d41a9d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_managed_boot_diagnostics.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_managed_boot_diagnostics.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_os_image_scheduled_event_enabled.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_os_image_scheduled_event_enabled.py index 0b231be0301c..bbce6100a02a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_os_image_scheduled_event_enabled.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_os_image_scheduled_event_enabled.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_password_authentication.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_password_authentication.py index 817d429b1989..4c2afe2c1029 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_password_authentication.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_password_authentication.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_premium_storage.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_premium_storage.py index ed5871dd9100..984702231c8f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_premium_storage.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_premium_storage.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_priority_mix_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_priority_mix_policy.py index 2dd4509eb0a2..a2069bb3a914 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_priority_mix_policy.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_priority_mix_policy.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_protected_settings_from_key_vault.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_protected_settings_from_key_vault.py index 3139abf681ad..4faa40525547 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_protected_settings_from_key_vault.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_protected_settings_from_key_vault.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_proxy_agent_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_proxy_agent_settings.py index 6e7e72ca28fd..887a15c30ee3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_proxy_agent_settings.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_proxy_agent_settings.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py index 78b776a7e404..0857de279110 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py index 13bf17277293..5f6e55213a94 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_scale_in_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_scale_in_policy.py index d2a931b49a19..ce12dfccd46c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_scale_in_policy.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_scale_in_policy.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_posture_reference.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_posture_reference.py index 0e63011a484c..ed60275436bb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_posture_reference.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_posture_reference.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm.py index d83780c33c09..39606e243ee9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm_with_non_persisted_tpm.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm_with_non_persisted_tpm.py index f30d81a5f4c9..34582b87f8e1 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm_with_non_persisted_tpm.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_security_type_confidential_vm_with_non_persisted_tpm.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_service_artifact_reference.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_service_artifact_reference.py index efd37b773320..c66bd4e04497 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_service_artifact_reference.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_service_artifact_reference.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile.py index 533002b2a893..bc0f44533fc8 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile_prioritized.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile_prioritized.py index 2450f2454924..c3105ca4223e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile_prioritized.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_sku_profile_prioritized.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_spot_restore_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_spot_restore_policy.py index eb3d063eeb72..025c57a5cac2 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_spot_restore_policy.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_spot_restore_policy.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_ssh_authentication.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_ssh_authentication.py index f6a98b544061..dddc6239ce34 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_ssh_authentication.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_ssh_authentication.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_terminate_scheduled_event_enabled.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_terminate_scheduled_event_enabled.py index 6151ff0473b4..c02141f198b9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_terminate_scheduled_event_enabled.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_terminate_scheduled_event_enabled.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_uefi_settings.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_uefi_settings.py index f4eb3a5f7910..a7b77ac26131 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_uefi_settings.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_uefi_settings.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_user_data.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_user_data.py index 87cde2121c47..837733e4c2ae 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_user_data.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_user_data.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vm_size_properties.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vm_size_properties.py index 4764a42436c6..9e6760f9b652 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vm_size_properties.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vm_size_properties.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vms_in_different_zones.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vms_in_different_zones.py index ac0fd927d184..5ba59c4279be 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vms_in_different_zones.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_vms_in_different_zones.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_zonal_platform_fault_domain_align_mode.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_zonal_platform_fault_domain_align_mode.py index e23cd83a75ce..e38591647061 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_zonal_platform_fault_domain_align_mode.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_zonal_platform_fault_domain_align_mode.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_maximum_set_gen.py index 344c8f5c2707..52a5a27c97ae 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_minimum_set_gen.py index 68dd87bcfd16..2c36988fedf7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_deallocate_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_delete_force.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_delete_force.py index 6641ba86df9c..e0a1d03019f9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_delete_force.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_delete_force.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_create_or_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_create_or_update_maximum_set_gen.py index a26e0d591e68..db8e9640d7cc 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_create_or_update_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_create_or_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_maximum_set_gen.py index 315cbb66ccc1..6e90460aa2a6 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_minimum_set_gen.py index 203f37a169af..20b56854f162 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_delete_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_maximum_set_gen.py index 6dbf2455f4a1..9b6d6d014ef7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_minimum_set_gen.py index f1fc84ad4b54..3cd26f69cc32 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_get_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_maximum_set_gen.py index a906e0af354a..0be9e2bee051 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_minimum_set_gen.py index 452b77cd8c4f..c24013a723ca 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_rolling_upgrade.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_rolling_upgrade.py index 36ef5c512e23..72824ef34a78 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_rolling_upgrade.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_rolling_upgrade.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_update_maximum_set_gen.py index 6aca09d8d771..61ef0e996656 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_update_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_extension_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_maximum_set_gen.py index c5e765c70d72..0af83f6dee63 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_minimum_set_gen.py index 37c458168c7b..38c82963dcc8 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get.py index 8bc391fa84e7..920084f2c5ba 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_auto_placed_on_dedicated_host_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_auto_placed_on_dedicated_host_group.py index 21b88c0a5d1a..5df7e80f3857 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_auto_placed_on_dedicated_host_group.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_auto_placed_on_dedicated_host_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_maximum_set_gen.py index 45243a913ad0..cf2f10282c0c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_minimum_set_gen.py index 13c72d3ec0e3..1bdd8ad1f12c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_instance_view_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_maximum_set_gen.py index bd69914d9a06..720e6609cc19 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_minimum_set_gen.py index 3c7ce0a05ec6..427893767c70 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_os_upgrade_history_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_disk_controller_type.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_disk_controller_type.py index b06368a3e7a6..507f00101ca4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_disk_controller_type.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_disk_controller_type.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_user_data.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_user_data.py index f808e14a9efd..36d865ae5d25 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_user_data.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_get_with_user_data.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_maximum_set_gen.py index 4e6152e733f4..c8bc3b5ca8ff 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_minimum_set_gen.py index 80eb6dca8458..bab167622f99 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_all_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_by_subscription_by_location.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_by_subscription_by_location.py index 91557b0c9c17..76dcadbc3b7c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_by_subscription_by_location.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_by_subscription_by_location.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_maximum_set_gen.py index ef4a863e4cad..fbbbaaee11ce 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_minimum_set_gen.py index 4323f730c6f4..f8929da5e352 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_maximum_set_gen.py index b7b787e28637..5a0b72919393 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_minimum_set_gen.py index d9a42bde4bd0..e0420b1285f0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_list_skus_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_maximum_set_gen.py index d4804a33584d..92264cfc80be 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_minimum_set_gen.py index 33ce6ee800c8..20bf52339ba4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_perform_maintenance_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_maximum_set_gen.py index f270e5a11a78..d5397d162ad3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_minimum_set_gen.py index f631543813b8..3962b505a67d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_power_off_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_maximum_set_gen.py index f51fcc3c9d39..2cc5b51df118 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_minimum_set_gen.py index 9124a9902319..34c67bf23a48 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reapply_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_maximum_set_gen.py index 21deb667f055..4837b36cf7a1 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_minimum_set_gen.py index dfc5ab505ab2..f831be744cea 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_redeploy_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_maximum_set_gen.py index 5c966ab51ea1..61e911ff6318 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_minimum_set_gen.py index 4461f31ba202..0ed697110505 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_all_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_maximum_set_gen.py index d8d60727f60f..da972102643c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_minimum_set_gen.py index a2cd66f9d1d0..48ad3ff897e3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_reimage_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_maximum_set_gen.py index d621d726232b..d9acedc5a0a1 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_minimum_set_gen.py index 59fd38842273..2b98929c79e0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_restart_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_maximum_set_gen.py index 2e94169c428a..020f4edde4a7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_minimum_set_gen.py index 98a276961bfd..ed1c400a3e8c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_cancel_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_maximum_set_gen.py index a30a2e1ffc38..c48bb423f6ab 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_minimum_set_gen.py index 9664c2ddd20d..94d65b359ea9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_get_latest_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_maximum_set_gen.py index e8f24384b6d0..61bf5a3ba93d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_minimum_set_gen.py index 4600f68b0335..a239a956be9f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_maximum_set_gen.py index 8f3c1ad60db5..720d2f19b901 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_minimum_set_gen.py index 4172165a29b8..5af98c033dae 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_set_orchestration_service_state_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_maximum_set_gen.py index 84908b4bbfa5..e8c8d505330d 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_minimum_set_gen.py index 331a72231591..6bef41da106b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_start_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_update_maximum_set_gen.py index 9bf430327c29..5cbc45890aa6 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_update_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_approve_rolling_upgrade.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_approve_rolling_upgrade.py index f7164bf52080..449d6f2cb8ba 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_approve_rolling_upgrade.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_approve_rolling_upgrade.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_maximum_set_gen.py index 1285ad38dda4..a24cd43c4e02 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_minimum_set_gen.py index 0ff53563fc8a..3c57f3e9da3c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_attach_detach_data_disks_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_maximum_set_gen.py index b1c15288a2dd..596dc4e9e3f7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_minimum_set_gen.py index 524f11241ed0..1c810cfa4282 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_deallocate_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_delete_force.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_delete_force.py index c08b8708a8a7..88eb18973685 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_delete_force.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_delete_force.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_create.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_create.py index 0130eb8afdea..06f7314272a9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_create.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_create.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_delete.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_delete.py index aa5e3c7e5444..bb8cba16415a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_delete.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_get.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_get.py index 4e6f352aca72..ef61b3aa73a0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_get.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_list.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_list.py index 92076fcf610c..e7b4b6816e12 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_list.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_update.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_update.py index d0885ce5d507..43934aa9a96b 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_update.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_extension_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_instance_view_auto_placed_on_dedicated_host_group.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_instance_view_auto_placed_on_dedicated_host_group.py index f99158ee7e6e..52980f4dd108 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_instance_view_auto_placed_on_dedicated_host_group.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_instance_view_auto_placed_on_dedicated_host_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_resilient_vm_deletion_status.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_resilient_vm_deletion_status.py index a3382838ad3c..57e2bd854520 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_resilient_vm_deletion_status.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_resilient_vm_deletion_status.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_user_data.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_user_data.py index c5352ebee942..449c6335db03 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_user_data.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_user_data.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_vm_size_properties.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_vm_size_properties.py index 880166b1e15a..f7963f92d34f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_vm_size_properties.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_get_with_vm_size_properties.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_maximum_set_gen.py index 02353acba6ac..8ef4fd645dbb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_minimum_set_gen.py index 3712e6d79306..b7b7f9311df3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,7 +33,7 @@ def main(): response = client.virtual_machine_scale_set_vms.list( resource_group_name="rgcompute", - virtual_machine_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", + virtual_machine_scale_set_name="aaaaaaaaaaaaaa", ) for item in response: print(item) diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_with_resiliency_view.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_with_resiliency_view.py index ee8ab3692ba5..a36589b620b0 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_with_resiliency_view.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_list_with_resiliency_view.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_maximum_set_gen.py index a207801b4cf5..f8f391b05d7c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_minimum_set_gen.py index 8ea3f930ecca..228a82355ee6 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_perform_maintenance_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_maximum_set_gen.py index 938f57749e22..71b95cf66469 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_minimum_set_gen.py index 4e4c4d2856b5..72e9fef35dfd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_power_off_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_maximum_set_gen.py index a8e81c81fb79..c9ffb66cb044 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_minimum_set_gen.py index 3c054e34154b..1655333e4689 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_redeploy_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_maximum_set_gen.py index e2c77ae02b6d..d4739f9e793f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_minimum_set_gen.py index bfdf98d4d489..988beb9b4c55 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_all_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_maximum_set_gen.py index 01e43554e7c7..5f5de8f56fbb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_minimum_set_gen.py index 50ceb9927e34..09f917d9a6fe 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_reimage_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_maximum_set_gen.py index ed1b3bd96d3f..05c736fdde3f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_minimum_set_gen.py index 44333119fa99..4c1755071b71 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_restart_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_retrieve_boot_diagnostics_data.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_retrieve_boot_diagnostics_data.py index 2e3dfca0ae96..5fd9523f77f3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_retrieve_boot_diagnostics_data.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_retrieve_boot_diagnostics_data.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_simulate_eviction.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_simulate_eviction.py index 6c92e9c5796d..ef13fa866a31 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_simulate_eviction.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_simulate_eviction.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_maximum_set_gen.py index 1696b36394d4..c7549287b3d4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_minimum_set_gen.py index dac4bcf9b396..49aa83283432 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_start_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_maximum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_maximum_set_gen.py index f734a382ad06..7aca28f4fd78 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_maximum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_maximum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_minimum_set_gen.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_minimum_set_gen.py index 5396ebccb481..1fdc96bfc662 100644 --- a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_minimum_set_gen.py +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_vm_update_minimum_set_gen.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations.py index ffa4881c7178..2148217256d4 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,39 @@ class TestComputeManagementAvailabilitySetsOperations(AzureMgmtRecordedTestCase) def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_availability_sets_list_by_subscription(self, resource_group): + response = self.client.availability_sets.list_by_subscription( + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_availability_sets_list(self, resource_group): + response = self.client.availability_sets.list( + resource_group_name=resource_group.name, + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_availability_sets_get(self, resource_group): + response = self.client.availability_sets.get( + resource_group_name=resource_group.name, + availability_set_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_availability_sets_create_or_update(self, resource_group): @@ -46,6 +79,14 @@ def test_availability_sets_create_or_update(self, resource_group): "time": "2020-02-20 00:00:00", } ], + "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", "virtualMachineScaleSetMigrationInfo": { @@ -118,8 +159,8 @@ def test_availability_sets_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_availability_sets_get(self, resource_group): - response = self.client.availability_sets.get( + def test_availability_sets_cancel_migration_to_virtual_machine_scale_set(self, resource_group): + response = self.client.availability_sets.cancel_migration_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", api_version="2024-11-01", @@ -130,34 +171,13 @@ def test_availability_sets_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_availability_sets_list_by_subscription(self, resource_group): - response = self.client.availability_sets.list_by_subscription( - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_availability_sets_list(self, resource_group): - response = self.client.availability_sets.list( - resource_group_name=resource_group.name, - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_availability_sets_list_available_sizes(self, resource_group): - response = self.client.availability_sets.list_available_sizes( + def test_availability_sets_begin_convert_to_virtual_machine_scale_set(self, resource_group): + response = self.client.availability_sets.begin_convert_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", api_version="2024-11-01", - ) - result = [r for r in response] + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... @@ -174,18 +194,6 @@ def test_availability_sets_start_migration_to_virtual_machine_scale_set(self, re # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_availability_sets_cancel_migration_to_virtual_machine_scale_set(self, resource_group): - response = self.client.availability_sets.cancel_migration_to_virtual_machine_scale_set( - resource_group_name=resource_group.name, - availability_set_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_availability_sets_validate_migration_to_virtual_machine_scale_set(self, resource_group): @@ -201,12 +209,12 @@ def test_availability_sets_validate_migration_to_virtual_machine_scale_set(self, @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_availability_sets_begin_convert_to_virtual_machine_scale_set(self, resource_group): - response = self.client.availability_sets.begin_convert_to_virtual_machine_scale_set( + def test_availability_sets_list_available_sizes(self, resource_group): + response = self.client.availability_sets.list_available_sizes( resource_group_name=resource_group.name, availability_set_name="str", api_version="2024-11-01", - ).result() # call '.result()' to poll until service return final result - + ) + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations_async.py index 45731b30b4ee..436a4724d3c5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_availability_sets_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,39 @@ class TestComputeManagementAvailabilitySetsOperationsAsync(AzureMgmtRecordedTest def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_availability_sets_list_by_subscription(self, resource_group): + response = self.client.availability_sets.list_by_subscription( + api_version="2024-11-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_availability_sets_list(self, resource_group): + response = self.client.availability_sets.list( + resource_group_name=resource_group.name, + api_version="2024-11-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_availability_sets_get(self, resource_group): + response = await self.client.availability_sets.get( + resource_group_name=resource_group.name, + availability_set_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_availability_sets_create_or_update(self, resource_group): @@ -47,6 +80,14 @@ async def test_availability_sets_create_or_update(self, resource_group): "time": "2020-02-20 00:00:00", } ], + "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", "virtualMachineScaleSetMigrationInfo": { @@ -119,8 +160,8 @@ async def test_availability_sets_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_availability_sets_get(self, resource_group): - response = await self.client.availability_sets.get( + async def test_availability_sets_cancel_migration_to_virtual_machine_scale_set(self, resource_group): + response = await self.client.availability_sets.cancel_migration_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", api_version="2024-11-01", @@ -131,34 +172,15 @@ async def test_availability_sets_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_availability_sets_list_by_subscription(self, resource_group): - response = self.client.availability_sets.list_by_subscription( - api_version="2024-11-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_availability_sets_list(self, resource_group): - response = self.client.availability_sets.list( - resource_group_name=resource_group.name, - api_version="2024-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + async def test_availability_sets_begin_convert_to_virtual_machine_scale_set(self, resource_group): + response = await ( + await self.client.availability_sets.begin_convert_to_virtual_machine_scale_set( + resource_group_name=resource_group.name, + availability_set_name="str", + api_version="2024-11-01", + ) + ).result() # call '.result()' to poll until service return final result - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_availability_sets_list_available_sizes(self, resource_group): - response = self.client.availability_sets.list_available_sizes( - resource_group_name=resource_group.name, - availability_set_name="str", - api_version="2024-11-01", - ) - result = [r async for r in response] # please add some check logic here by yourself # ... @@ -177,10 +199,11 @@ async def test_availability_sets_start_migration_to_virtual_machine_scale_set(se @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_availability_sets_cancel_migration_to_virtual_machine_scale_set(self, resource_group): - response = await self.client.availability_sets.cancel_migration_to_virtual_machine_scale_set( + async def test_availability_sets_validate_migration_to_virtual_machine_scale_set(self, resource_group): + response = await self.client.availability_sets.validate_migration_to_virtual_machine_scale_set( resource_group_name=resource_group.name, availability_set_name="str", + parameters={"virtualMachineScaleSetFlexible": {"id": "str"}}, api_version="2024-11-01", ) @@ -189,27 +212,12 @@ async def test_availability_sets_cancel_migration_to_virtual_machine_scale_set(s @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_availability_sets_validate_migration_to_virtual_machine_scale_set(self, resource_group): - response = await self.client.availability_sets.validate_migration_to_virtual_machine_scale_set( + async def test_availability_sets_list_available_sizes(self, resource_group): + response = self.client.availability_sets.list_available_sizes( resource_group_name=resource_group.name, availability_set_name="str", - parameters={"virtualMachineScaleSetFlexible": {"id": "str"}}, api_version="2024-11-01", ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_availability_sets_begin_convert_to_virtual_machine_scale_set(self, resource_group): - response = await ( - await self.client.availability_sets.begin_convert_to_virtual_machine_scale_set( - resource_group_name=resource_group.name, - availability_set_name="str", - api_version="2024-11-01", - ) - ).result() # call '.result()' to poll until service return final result - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations.py index 790ba618ad0f..58539fb5a5fb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,39 @@ class TestComputeManagementCapacityReservationGroupsOperations(AzureMgmtRecorded def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_capacity_reservation_groups_list_by_subscription(self, resource_group): + response = self.client.capacity_reservation_groups.list_by_subscription( + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_capacity_reservation_groups_list_by_resource_group(self, resource_group): + response = self.client.capacity_reservation_groups.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_capacity_reservation_groups_get(self, resource_group): + response = self.client.capacity_reservation_groups.get( + resource_group_name=resource_group.name, + capacity_reservation_group_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_capacity_reservation_groups_create_or_update(self, resource_group): @@ -48,6 +81,14 @@ def test_capacity_reservation_groups_create_or_update(self, resource_group): }, "name": "str", "sharingProfile": {"subscriptionIds": [{"id": "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", "virtualMachinesAssociated": [{"id": "str"}], @@ -106,36 +147,3 @@ def test_capacity_reservation_groups_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_capacity_reservation_groups_get(self, resource_group): - response = self.client.capacity_reservation_groups.get( - resource_group_name=resource_group.name, - capacity_reservation_group_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_capacity_reservation_groups_list_by_resource_group(self, resource_group): - response = self.client.capacity_reservation_groups.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_capacity_reservation_groups_list_by_subscription(self, resource_group): - response = self.client.capacity_reservation_groups.list_by_subscription( - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations_async.py index 104d59afec66..2b62f4dc2307 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservation_groups_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,39 @@ class TestComputeManagementCapacityReservationGroupsOperationsAsync(AzureMgmtRec def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_capacity_reservation_groups_list_by_subscription(self, resource_group): + response = self.client.capacity_reservation_groups.list_by_subscription( + api_version="2024-11-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_capacity_reservation_groups_list_by_resource_group(self, resource_group): + response = self.client.capacity_reservation_groups.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-11-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_capacity_reservation_groups_get(self, resource_group): + response = await self.client.capacity_reservation_groups.get( + resource_group_name=resource_group.name, + capacity_reservation_group_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_capacity_reservation_groups_create_or_update(self, resource_group): @@ -49,6 +82,14 @@ async def test_capacity_reservation_groups_create_or_update(self, resource_group }, "name": "str", "sharingProfile": {"subscriptionIds": [{"id": "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", "virtualMachinesAssociated": [{"id": "str"}], @@ -107,36 +148,3 @@ async def test_capacity_reservation_groups_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_capacity_reservation_groups_get(self, resource_group): - response = await self.client.capacity_reservation_groups.get( - resource_group_name=resource_group.name, - capacity_reservation_group_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_capacity_reservation_groups_list_by_resource_group(self, resource_group): - response = self.client.capacity_reservation_groups.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-11-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_capacity_reservation_groups_list_by_subscription(self, resource_group): - response = self.client.capacity_reservation_groups.list_by_subscription( - api_version="2024-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations.py index 919fbefb82ef..6b29bbd0fe75 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,31 @@ class TestComputeManagementCapacityReservationsOperations(AzureMgmtRecordedTestC def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_capacity_reservations_list_by_capacity_reservation_group(self, resource_group): + response = self.client.capacity_reservations.list_by_capacity_reservation_group( + resource_group_name=resource_group.name, + capacity_reservation_group_name="str", + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_capacity_reservations_get(self, resource_group): + response = self.client.capacity_reservations.get( + resource_group_name=resource_group.name, + capacity_reservation_group_name="str", + capacity_reservation_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_capacity_reservations_begin_create_or_update(self, resource_group): @@ -46,6 +71,14 @@ def test_capacity_reservations_begin_create_or_update(self, resource_group): "provisioningState": "str", "provisioningTime": "2020-02-20 00:00:00", "reservationId": "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"}, "timeCreated": "2020-02-20 00:00:00", "type": "str", @@ -105,28 +138,3 @@ def test_capacity_reservations_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_capacity_reservations_get(self, resource_group): - response = self.client.capacity_reservations.get( - resource_group_name=resource_group.name, - capacity_reservation_group_name="str", - capacity_reservation_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_capacity_reservations_list_by_capacity_reservation_group(self, resource_group): - response = self.client.capacity_reservations.list_by_capacity_reservation_group( - resource_group_name=resource_group.name, - capacity_reservation_group_name="str", - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations_async.py index 4dd700c1322d..79c1224b3325 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_capacity_reservations_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,31 @@ class TestComputeManagementCapacityReservationsOperationsAsync(AzureMgmtRecorded def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_capacity_reservations_list_by_capacity_reservation_group(self, resource_group): + response = self.client.capacity_reservations.list_by_capacity_reservation_group( + resource_group_name=resource_group.name, + capacity_reservation_group_name="str", + api_version="2024-11-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_capacity_reservations_get(self, resource_group): + response = await self.client.capacity_reservations.get( + resource_group_name=resource_group.name, + capacity_reservation_group_name="str", + capacity_reservation_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_capacity_reservations_begin_create_or_update(self, resource_group): @@ -48,6 +73,14 @@ async def test_capacity_reservations_begin_create_or_update(self, resource_group "provisioningState": "str", "provisioningTime": "2020-02-20 00:00:00", "reservationId": "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"}, "timeCreated": "2020-02-20 00:00:00", "type": "str", @@ -112,28 +145,3 @@ async def test_capacity_reservations_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_capacity_reservations_get(self, resource_group): - response = await self.client.capacity_reservations.get( - resource_group_name=resource_group.name, - capacity_reservation_group_name="str", - capacity_reservation_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_capacity_reservations_list_by_capacity_reservation_group(self, resource_group): - response = self.client.capacity_reservations.list_by_capacity_reservation_group( - resource_group_name=resource_group.name, - capacity_reservation_group_name="str", - api_version="2024-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations.py index d36e68d632c2..e51be9ce01a9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,39 @@ class TestComputeManagementDedicatedHostGroupsOperations(AzureMgmtRecordedTestCa def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dedicated_host_groups_list_by_subscription(self, resource_group): + response = self.client.dedicated_host_groups.list_by_subscription( + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dedicated_host_groups_list_by_resource_group(self, resource_group): + response = self.client.dedicated_host_groups.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dedicated_host_groups_get(self, resource_group): + response = self.client.dedicated_host_groups.get( + resource_group_name=resource_group.name, + host_group_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_dedicated_host_groups_create_or_update(self, resource_group): @@ -50,6 +83,14 @@ def test_dedicated_host_groups_create_or_update(self, resource_group): "name": "str", "platformFaultDomainCount": 0, "supportAutomaticPlacement": bool, + "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", "zones": ["str"], @@ -109,36 +150,3 @@ def test_dedicated_host_groups_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_dedicated_host_groups_get(self, resource_group): - response = self.client.dedicated_host_groups.get( - resource_group_name=resource_group.name, - host_group_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_dedicated_host_groups_list_by_resource_group(self, resource_group): - response = self.client.dedicated_host_groups.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_dedicated_host_groups_list_by_subscription(self, resource_group): - response = self.client.dedicated_host_groups.list_by_subscription( - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations_async.py index c70854c47514..dd0d2eddc6a7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_host_groups_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,39 @@ class TestComputeManagementDedicatedHostGroupsOperationsAsync(AzureMgmtRecordedT def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dedicated_host_groups_list_by_subscription(self, resource_group): + response = self.client.dedicated_host_groups.list_by_subscription( + api_version="2024-11-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_dedicated_host_groups_list_by_resource_group(self, resource_group): + response = self.client.dedicated_host_groups.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-11-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_dedicated_host_groups_get(self, resource_group): + response = await self.client.dedicated_host_groups.get( + resource_group_name=resource_group.name, + host_group_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_dedicated_host_groups_create_or_update(self, resource_group): @@ -51,6 +84,14 @@ async def test_dedicated_host_groups_create_or_update(self, resource_group): "name": "str", "platformFaultDomainCount": 0, "supportAutomaticPlacement": bool, + "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", "zones": ["str"], @@ -110,36 +151,3 @@ async def test_dedicated_host_groups_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_dedicated_host_groups_get(self, resource_group): - response = await self.client.dedicated_host_groups.get( - resource_group_name=resource_group.name, - host_group_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_dedicated_host_groups_list_by_resource_group(self, resource_group): - response = self.client.dedicated_host_groups.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-11-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_dedicated_host_groups_list_by_subscription(self, resource_group): - response = self.client.dedicated_host_groups.list_by_subscription( - api_version="2024-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations.py index 3743fe349c52..1beeab205a8a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,31 @@ class TestComputeManagementDedicatedHostsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dedicated_hosts_list_by_host_group(self, resource_group): + response = self.client.dedicated_hosts.list_by_host_group( + resource_group_name=resource_group.name, + host_group_name="str", + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dedicated_hosts_get(self, resource_group): + response = self.client.dedicated_hosts.get( + resource_group_name=resource_group.name, + host_group_name="str", + host_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_dedicated_hosts_begin_create_or_update(self, resource_group): @@ -49,6 +74,14 @@ def test_dedicated_hosts_begin_create_or_update(self, resource_group): "platformFaultDomain": 0, "provisioningState": "str", "provisioningTime": "2020-02-20 00:00:00", + "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"}, "timeCreated": "2020-02-20 00:00:00", "type": "str", @@ -113,42 +146,17 @@ def test_dedicated_hosts_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_dedicated_hosts_get(self, resource_group): - response = self.client.dedicated_hosts.get( + def test_dedicated_hosts_list_available_sizes(self, resource_group): + response = self.client.dedicated_hosts.list_available_sizes( resource_group_name=resource_group.name, host_group_name="str", host_name="str", api_version="2024-11-01", ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_dedicated_hosts_list_by_host_group(self, resource_group): - response = self.client.dedicated_hosts.list_by_host_group( - resource_group_name=resource_group.name, - host_group_name="str", - api_version="2024-11-01", - ) result = [r for r in response] # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_dedicated_hosts_begin_restart(self, resource_group): - response = self.client.dedicated_hosts.begin_restart( - resource_group_name=resource_group.name, - host_group_name="str", - host_name="str", - api_version="2024-11-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_dedicated_hosts_begin_redeploy(self, resource_group): @@ -164,13 +172,13 @@ def test_dedicated_hosts_begin_redeploy(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_dedicated_hosts_list_available_sizes(self, resource_group): - response = self.client.dedicated_hosts.list_available_sizes( + def test_dedicated_hosts_begin_restart(self, resource_group): + response = self.client.dedicated_hosts.begin_restart( resource_group_name=resource_group.name, host_group_name="str", host_name="str", api_version="2024-11-01", - ) - result = [r for r in response] + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations_async.py index 2b703bdba4d4..8f88bd04ae56 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_dedicated_hosts_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,31 @@ class TestComputeManagementDedicatedHostsOperationsAsync(AzureMgmtRecordedTestCa def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dedicated_hosts_list_by_host_group(self, resource_group): + response = self.client.dedicated_hosts.list_by_host_group( + resource_group_name=resource_group.name, + host_group_name="str", + api_version="2024-11-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_dedicated_hosts_get(self, resource_group): + response = await self.client.dedicated_hosts.get( + resource_group_name=resource_group.name, + host_group_name="str", + host_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_dedicated_hosts_begin_create_or_update(self, resource_group): @@ -51,6 +76,14 @@ async def test_dedicated_hosts_begin_create_or_update(self, resource_group): "platformFaultDomain": 0, "provisioningState": "str", "provisioningTime": "2020-02-20 00:00:00", + "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"}, "timeCreated": "2020-02-20 00:00:00", "type": "str", @@ -120,34 +153,22 @@ async def test_dedicated_hosts_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_dedicated_hosts_get(self, resource_group): - response = await self.client.dedicated_hosts.get( + async def test_dedicated_hosts_list_available_sizes(self, resource_group): + response = self.client.dedicated_hosts.list_available_sizes( resource_group_name=resource_group.name, host_group_name="str", host_name="str", api_version="2024-11-01", ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_dedicated_hosts_list_by_host_group(self, resource_group): - response = self.client.dedicated_hosts.list_by_host_group( - resource_group_name=resource_group.name, - host_group_name="str", - api_version="2024-11-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_dedicated_hosts_begin_restart(self, resource_group): + async def test_dedicated_hosts_begin_redeploy(self, resource_group): response = await ( - await self.client.dedicated_hosts.begin_restart( + await self.client.dedicated_hosts.begin_redeploy( resource_group_name=resource_group.name, host_group_name="str", host_name="str", @@ -160,9 +181,9 @@ async def test_dedicated_hosts_begin_restart(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_dedicated_hosts_begin_redeploy(self, resource_group): + async def test_dedicated_hosts_begin_restart(self, resource_group): response = await ( - await self.client.dedicated_hosts.begin_redeploy( + await self.client.dedicated_hosts.begin_restart( resource_group_name=resource_group.name, host_group_name="str", host_name="str", @@ -172,16 +193,3 @@ async def test_dedicated_hosts_begin_redeploy(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_dedicated_hosts_list_available_sizes(self, resource_group): - response = self.client.dedicated_hosts.list_available_sizes( - resource_group_name=resource_group.name, - host_group_name="str", - host_name="str", - api_version="2024-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations.py index eb9f8554116d..b6f1fcf22c1c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,39 @@ class TestComputeManagementImagesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_images_list(self, resource_group): + response = self.client.images.list( + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_images_list_by_resource_group(self, resource_group): + response = self.client.images.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_images_get(self, resource_group): + response = self.client.images.get( + resource_group_name=resource_group.name, + image_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_images_begin_create_or_update(self, resource_group): @@ -58,6 +91,14 @@ def test_images_begin_create_or_update(self, resource_group): }, "zoneResilient": bool, }, + "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", }, @@ -122,36 +163,3 @@ def test_images_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_images_get(self, resource_group): - response = self.client.images.get( - resource_group_name=resource_group.name, - image_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_images_list_by_resource_group(self, resource_group): - response = self.client.images.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_images_list(self, resource_group): - response = self.client.images.list( - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations_async.py index 7b9d7f38918f..523beda29eda 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_images_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,39 @@ class TestComputeManagementImagesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_images_list(self, resource_group): + response = self.client.images.list( + api_version="2024-11-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_images_list_by_resource_group(self, resource_group): + response = self.client.images.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-11-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_images_get(self, resource_group): + response = await self.client.images.get( + resource_group_name=resource_group.name, + image_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_images_begin_create_or_update(self, resource_group): @@ -60,6 +93,14 @@ async def test_images_begin_create_or_update(self, resource_group): }, "zoneResilient": bool, }, + "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", }, @@ -129,36 +170,3 @@ async def test_images_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_images_get(self, resource_group): - response = await self.client.images.get( - resource_group_name=resource_group.name, - image_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_images_list_by_resource_group(self, resource_group): - response = self.client.images.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-11-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_images_list(self, resource_group): - response = self.client.images.list( - api_version="2024-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations.py index 301993f9a19f..d0855d0ac2cd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations_async.py index 3d7976d99d17..67c934d92275 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_log_analytics_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations.py index ed05bcf20bf4..13932fafd4b9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations_async.py index 30a354b38846..83171f08bd8a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations.py index 36326323ffc4..a4e9f0442e16 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,39 @@ class TestComputeManagementProximityPlacementGroupsOperations(AzureMgmtRecordedT def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_proximity_placement_groups_list_by_subscription(self, resource_group): + response = self.client.proximity_placement_groups.list_by_subscription( + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_proximity_placement_groups_list_by_resource_group(self, resource_group): + response = self.client.proximity_placement_groups.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_proximity_placement_groups_get(self, resource_group): + response = self.client.proximity_placement_groups.get( + resource_group_name=resource_group.name, + proximity_placement_group_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_proximity_placement_groups_create_or_update(self, resource_group): @@ -49,6 +82,14 @@ def test_proximity_placement_groups_create_or_update(self, resource_group): "intent": {"vmSizes": ["str"]}, "name": "str", "proximityPlacementGroupType": "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", "virtualMachineScaleSets": [ @@ -107,36 +148,3 @@ def test_proximity_placement_groups_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_proximity_placement_groups_get(self, resource_group): - response = self.client.proximity_placement_groups.get( - resource_group_name=resource_group.name, - proximity_placement_group_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_proximity_placement_groups_list_by_subscription(self, resource_group): - response = self.client.proximity_placement_groups.list_by_subscription( - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_proximity_placement_groups_list_by_resource_group(self, resource_group): - response = self.client.proximity_placement_groups.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations_async.py index ee1b92c7128a..af8efbf9891e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_proximity_placement_groups_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,39 @@ class TestComputeManagementProximityPlacementGroupsOperationsAsync(AzureMgmtReco def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_proximity_placement_groups_list_by_subscription(self, resource_group): + response = self.client.proximity_placement_groups.list_by_subscription( + api_version="2024-11-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_proximity_placement_groups_list_by_resource_group(self, resource_group): + response = self.client.proximity_placement_groups.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-11-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_proximity_placement_groups_get(self, resource_group): + response = await self.client.proximity_placement_groups.get( + resource_group_name=resource_group.name, + proximity_placement_group_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_proximity_placement_groups_create_or_update(self, resource_group): @@ -50,6 +83,14 @@ async def test_proximity_placement_groups_create_or_update(self, resource_group) "intent": {"vmSizes": ["str"]}, "name": "str", "proximityPlacementGroupType": "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", "virtualMachineScaleSets": [ @@ -108,36 +149,3 @@ async def test_proximity_placement_groups_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_proximity_placement_groups_get(self, resource_group): - response = await self.client.proximity_placement_groups.get( - resource_group_name=resource_group.name, - proximity_placement_group_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_proximity_placement_groups_list_by_subscription(self, resource_group): - response = self.client.proximity_placement_groups.list_by_subscription( - api_version="2024-11-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_proximity_placement_groups_list_by_resource_group(self, resource_group): - response = self.client.proximity_placement_groups.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations.py index 235385831fb1..54b93790627a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,39 @@ class TestComputeManagementRestorePointCollectionsOperations(AzureMgmtRecordedTe def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restore_point_collections_list_all(self, resource_group): + response = self.client.restore_point_collections.list_all( + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restore_point_collections_list(self, resource_group): + response = self.client.restore_point_collections.list( + resource_group_name=resource_group.name, + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restore_point_collections_get(self, resource_group): + response = self.client.restore_point_collections.get( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_restore_point_collections_create_or_update(self, resource_group): @@ -193,11 +226,27 @@ def test_restore_point_collections_create_or_update(self, resource_group): "vmId": "str", }, "sourceRestorePoint": {"id": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "timeCreated": "2020-02-20 00:00:00", "type": "str", } ], "source": {"id": "str", "location": "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", }, @@ -379,6 +428,14 @@ def test_restore_point_collections_update(self, resource_group): "vmId": "str", }, "sourceRestorePoint": {"id": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "timeCreated": "2020-02-20 00:00:00", "type": "str", } @@ -403,36 +460,3 @@ def test_restore_point_collections_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_point_collections_get(self, resource_group): - response = self.client.restore_point_collections.get( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_point_collections_list(self, resource_group): - response = self.client.restore_point_collections.list( - resource_group_name=resource_group.name, - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_point_collections_list_all(self, resource_group): - response = self.client.restore_point_collections.list_all( - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations_async.py index 441bdeacd7c4..16ed8815485a 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_point_collections_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,39 @@ class TestComputeManagementRestorePointCollectionsOperationsAsync(AzureMgmtRecor def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restore_point_collections_list_all(self, resource_group): + response = self.client.restore_point_collections.list_all( + api_version="2024-11-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_restore_point_collections_list(self, resource_group): + response = self.client.restore_point_collections.list( + resource_group_name=resource_group.name, + api_version="2024-11-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_restore_point_collections_get(self, resource_group): + response = await self.client.restore_point_collections.get( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_restore_point_collections_create_or_update(self, resource_group): @@ -194,11 +227,27 @@ async def test_restore_point_collections_create_or_update(self, resource_group): "vmId": "str", }, "sourceRestorePoint": {"id": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "timeCreated": "2020-02-20 00:00:00", "type": "str", } ], "source": {"id": "str", "location": "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", }, @@ -380,6 +429,14 @@ async def test_restore_point_collections_update(self, resource_group): "vmId": "str", }, "sourceRestorePoint": {"id": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "timeCreated": "2020-02-20 00:00:00", "type": "str", } @@ -406,36 +463,3 @@ async def test_restore_point_collections_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_restore_point_collections_get(self, resource_group): - response = await self.client.restore_point_collections.get( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_restore_point_collections_list(self, resource_group): - response = self.client.restore_point_collections.list( - resource_group_name=resource_group.name, - api_version="2024-11-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_restore_point_collections_list_all(self, resource_group): - response = self.client.restore_point_collections.list_all( - api_version="2024-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations.py index 2a5ff310e69c..2384e7b34c74 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,19 @@ class TestComputeManagementRestorePointsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restore_points_get(self, resource_group): + response = self.client.restore_points.get( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + restore_point_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_restore_points_begin_create(self, resource_group): @@ -184,6 +197,14 @@ def test_restore_points_begin_create(self, resource_group): "vmId": "str", }, "sourceRestorePoint": {"id": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "timeCreated": "2020-02-20 00:00:00", "type": "str", }, @@ -205,16 +226,3 @@ def test_restore_points_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_restore_points_get(self, resource_group): - response = self.client.restore_points.get( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - restore_point_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations_async.py index 6bee2d4653ba..1be346762de7 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_restore_points_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,19 @@ class TestComputeManagementRestorePointsOperationsAsync(AzureMgmtRecordedTestCas def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restore_points_get(self, resource_group): + response = await self.client.restore_points.get( + resource_group_name=resource_group.name, + restore_point_collection_name="str", + restore_point_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_restore_points_begin_create(self, resource_group): @@ -189,6 +202,14 @@ async def test_restore_points_begin_create(self, resource_group): "vmId": "str", }, "sourceRestorePoint": {"id": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "timeCreated": "2020-02-20 00:00:00", "type": "str", }, @@ -213,16 +234,3 @@ async def test_restore_points_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_restore_points_get(self, resource_group): - response = await self.client.restore_points.get( - resource_group_name=resource_group.name, - restore_point_collection_name="str", - restore_point_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations.py index 0469597c756f..af2d0bd3295f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -39,6 +39,18 @@ def test_ssh_public_keys_list_by_resource_group(self, resource_group): # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_ssh_public_keys_get(self, resource_group): + response = self.client.ssh_public_keys.get( + resource_group_name=resource_group.name, + ssh_public_key_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_ssh_public_keys_create(self, resource_group): @@ -50,6 +62,14 @@ def test_ssh_public_keys_create(self, resource_group): "id": "str", "name": "str", "publicKey": "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", }, @@ -84,18 +104,6 @@ def test_ssh_public_keys_delete(self, resource_group): # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_ssh_public_keys_get(self, resource_group): - response = self.client.ssh_public_keys.get( - resource_group_name=resource_group.name, - ssh_public_key_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_ssh_public_keys_generate_key_pair(self, resource_group): diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations_async.py index ab9701888f12..c8822cf6d878 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_ssh_public_keys_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -40,6 +40,18 @@ async def test_ssh_public_keys_list_by_resource_group(self, resource_group): # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_ssh_public_keys_get(self, resource_group): + response = await self.client.ssh_public_keys.get( + resource_group_name=resource_group.name, + ssh_public_key_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_ssh_public_keys_create(self, resource_group): @@ -51,6 +63,14 @@ async def test_ssh_public_keys_create(self, resource_group): "id": "str", "name": "str", "publicKey": "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", }, @@ -85,18 +105,6 @@ async def test_ssh_public_keys_delete(self, resource_group): # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_ssh_public_keys_get(self, resource_group): - response = await self.client.ssh_public_keys.get( - resource_group_name=resource_group.name, - ssh_public_key_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_ssh_public_keys_generate_key_pair(self, resource_group): diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations.py index 1fe516cfd211..b67341e9a785 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations_async.py index aea1886af5c3..06f7715ff9aa 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_usage_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations.py index 06822439184c..f2654e5dcffd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -20,12 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_extension_images_get(self, resource_group): - response = self.client.virtual_machine_extension_images.get( + def test_virtual_machine_extension_images_list_types(self, resource_group): + response = self.client.virtual_machine_extension_images.list_types( location="str", publisher_name="str", - type="str", - version="str", api_version="2024-11-01", ) @@ -34,10 +32,11 @@ def test_virtual_machine_extension_images_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_extension_images_list_types(self, resource_group): - response = self.client.virtual_machine_extension_images.list_types( + def test_virtual_machine_extension_images_list_versions(self, resource_group): + response = self.client.virtual_machine_extension_images.list_versions( location="str", publisher_name="str", + type="str", api_version="2024-11-01", ) @@ -46,11 +45,12 @@ def test_virtual_machine_extension_images_list_types(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_extension_images_list_versions(self, resource_group): - response = self.client.virtual_machine_extension_images.list_versions( + def test_virtual_machine_extension_images_get(self, resource_group): + response = self.client.virtual_machine_extension_images.get( location="str", publisher_name="str", type="str", + version="str", api_version="2024-11-01", ) diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations_async.py index 70e87b95d9c1..c976f2e90375 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extension_images_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -21,12 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_extension_images_get(self, resource_group): - response = await self.client.virtual_machine_extension_images.get( + async def test_virtual_machine_extension_images_list_types(self, resource_group): + response = await self.client.virtual_machine_extension_images.list_types( location="str", publisher_name="str", - type="str", - version="str", api_version="2024-11-01", ) @@ -35,10 +33,11 @@ async def test_virtual_machine_extension_images_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_extension_images_list_types(self, resource_group): - response = await self.client.virtual_machine_extension_images.list_types( + async def test_virtual_machine_extension_images_list_versions(self, resource_group): + response = await self.client.virtual_machine_extension_images.list_versions( location="str", publisher_name="str", + type="str", api_version="2024-11-01", ) @@ -47,11 +46,12 @@ async def test_virtual_machine_extension_images_list_types(self, resource_group) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_extension_images_list_versions(self, resource_group): - response = await self.client.virtual_machine_extension_images.list_versions( + async def test_virtual_machine_extension_images_get(self, resource_group): + response = await self.client.virtual_machine_extension_images.get( location="str", publisher_name="str", type="str", + version="str", api_version="2024-11-01", ) diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations.py index 21ee1e5bfd9f..5cf8a36f4c9c 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,31 @@ class TestComputeManagementVirtualMachineExtensionsOperations(AzureMgmtRecordedT def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_extensions_list(self, resource_group): + response = self.client.virtual_machine_extensions.list( + resource_group_name=resource_group.name, + vm_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_extensions_get(self, resource_group): + response = self.client.virtual_machine_extensions.get( + resource_group_name=resource_group.name, + vm_name="str", + vm_extension_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_virtual_machine_extensions_begin_create_or_update(self, resource_group): @@ -26,6 +51,7 @@ def test_virtual_machine_extensions_begin_create_or_update(self, resource_group) vm_name="str", vm_extension_name="str", extension_parameters={ + "location": "str", "autoUpgradeMinorVersion": bool, "enableAutomaticUpgrade": bool, "forceUpdateTag": "str", @@ -53,7 +79,6 @@ def test_virtual_machine_extensions_begin_create_or_update(self, resource_group) "type": "str", "typeHandlerVersion": "str", }, - "location": "str", "name": "str", "protectedSettings": {}, "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, @@ -62,6 +87,14 @@ def test_virtual_machine_extensions_begin_create_or_update(self, resource_group) "publisher": "str", "settings": {}, "suppressFailures": bool, + "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", "typeHandlerVersion": "str", @@ -110,28 +143,3 @@ def test_virtual_machine_extensions_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_extensions_get(self, resource_group): - response = self.client.virtual_machine_extensions.get( - resource_group_name=resource_group.name, - vm_name="str", - vm_extension_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_extensions_list(self, resource_group): - response = self.client.virtual_machine_extensions.list( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations_async.py index b0eb74a09db4..57c0db415d24 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_extensions_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,31 @@ class TestComputeManagementVirtualMachineExtensionsOperationsAsync(AzureMgmtReco def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_extensions_list(self, resource_group): + response = await self.client.virtual_machine_extensions.list( + resource_group_name=resource_group.name, + vm_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_extensions_get(self, resource_group): + response = await self.client.virtual_machine_extensions.get( + resource_group_name=resource_group.name, + vm_name="str", + vm_extension_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_virtual_machine_extensions_begin_create_or_update(self, resource_group): @@ -28,6 +53,7 @@ async def test_virtual_machine_extensions_begin_create_or_update(self, resource_ vm_name="str", vm_extension_name="str", extension_parameters={ + "location": "str", "autoUpgradeMinorVersion": bool, "enableAutomaticUpgrade": bool, "forceUpdateTag": "str", @@ -55,7 +81,6 @@ async def test_virtual_machine_extensions_begin_create_or_update(self, resource_ "type": "str", "typeHandlerVersion": "str", }, - "location": "str", "name": "str", "protectedSettings": {}, "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, @@ -64,6 +89,14 @@ async def test_virtual_machine_extensions_begin_create_or_update(self, resource_ "publisher": "str", "settings": {}, "suppressFailures": bool, + "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", "typeHandlerVersion": "str", @@ -117,28 +150,3 @@ async def test_virtual_machine_extensions_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_extensions_get(self, resource_group): - response = await self.client.virtual_machine_extensions.get( - resource_group_name=resource_group.name, - vm_name="str", - vm_extension_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_extensions_list(self, resource_group): - response = await self.client.virtual_machine_extensions.list( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations.py index c298c5af4872..a082a91fba82 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -20,14 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_get(self, resource_group): - response = self.client.virtual_machine_images_edge_zone.get( + def test_virtual_machine_images_edge_zone_list_publishers(self, resource_group): + response = self.client.virtual_machine_images_edge_zone.list_publishers( location="str", edge_zone="str", - publisher_name="str", - offer="str", - skus="str", - version="str", api_version="2024-11-01", ) @@ -36,13 +32,11 @@ def test_virtual_machine_images_edge_zone_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_list(self, resource_group): - response = self.client.virtual_machine_images_edge_zone.list( + def test_virtual_machine_images_edge_zone_list_offers(self, resource_group): + response = self.client.virtual_machine_images_edge_zone.list_offers( location="str", edge_zone="str", publisher_name="str", - offer="str", - skus="str", api_version="2024-11-01", ) @@ -51,11 +45,12 @@ def test_virtual_machine_images_edge_zone_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_list_offers(self, resource_group): - response = self.client.virtual_machine_images_edge_zone.list_offers( + def test_virtual_machine_images_edge_zone_list_skus(self, resource_group): + response = self.client.virtual_machine_images_edge_zone.list_skus( location="str", edge_zone="str", publisher_name="str", + offer="str", api_version="2024-11-01", ) @@ -64,10 +59,13 @@ def test_virtual_machine_images_edge_zone_list_offers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_list_publishers(self, resource_group): - response = self.client.virtual_machine_images_edge_zone.list_publishers( + def test_virtual_machine_images_edge_zone_list(self, resource_group): + response = self.client.virtual_machine_images_edge_zone.list( location="str", edge_zone="str", + publisher_name="str", + offer="str", + skus="str", api_version="2024-11-01", ) @@ -76,12 +74,14 @@ def test_virtual_machine_images_edge_zone_list_publishers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_edge_zone_list_skus(self, resource_group): - response = self.client.virtual_machine_images_edge_zone.list_skus( + def test_virtual_machine_images_edge_zone_get(self, resource_group): + response = self.client.virtual_machine_images_edge_zone.get( location="str", edge_zone="str", publisher_name="str", offer="str", + skus="str", + version="str", api_version="2024-11-01", ) diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations_async.py index 0e91202d2b72..87dce50ec700 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_edge_zone_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -21,14 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_get(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone.get( + async def test_virtual_machine_images_edge_zone_list_publishers(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone.list_publishers( location="str", edge_zone="str", - publisher_name="str", - offer="str", - skus="str", - version="str", api_version="2024-11-01", ) @@ -37,13 +33,11 @@ async def test_virtual_machine_images_edge_zone_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_list(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone.list( + async def test_virtual_machine_images_edge_zone_list_offers(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone.list_offers( location="str", edge_zone="str", publisher_name="str", - offer="str", - skus="str", api_version="2024-11-01", ) @@ -52,11 +46,12 @@ async def test_virtual_machine_images_edge_zone_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_list_offers(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone.list_offers( + async def test_virtual_machine_images_edge_zone_list_skus(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone.list_skus( location="str", edge_zone="str", publisher_name="str", + offer="str", api_version="2024-11-01", ) @@ -65,10 +60,13 @@ async def test_virtual_machine_images_edge_zone_list_offers(self, resource_group @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_list_publishers(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone.list_publishers( + async def test_virtual_machine_images_edge_zone_list(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone.list( location="str", edge_zone="str", + publisher_name="str", + offer="str", + skus="str", api_version="2024-11-01", ) @@ -77,12 +75,14 @@ async def test_virtual_machine_images_edge_zone_list_publishers(self, resource_g @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_edge_zone_list_skus(self, resource_group): - response = await self.client.virtual_machine_images_edge_zone.list_skus( + async def test_virtual_machine_images_edge_zone_get(self, resource_group): + response = await self.client.virtual_machine_images_edge_zone.get( location="str", edge_zone="str", publisher_name="str", offer="str", + skus="str", + version="str", api_version="2024-11-01", ) diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations.py index 5a9125745c0b..1f4178cc27f3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -20,13 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_get(self, resource_group): - response = self.client.virtual_machine_images.get( + def test_virtual_machine_images_list_by_edge_zone(self, resource_group): + response = self.client.virtual_machine_images.list_by_edge_zone( location="str", - publisher_name="str", - offer="str", - skus="str", - version="str", + edge_zone="str", api_version="2024-11-01", ) @@ -35,12 +32,9 @@ def test_virtual_machine_images_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_list(self, resource_group): - response = self.client.virtual_machine_images.list( + def test_virtual_machine_images_list_publishers(self, resource_group): + response = self.client.virtual_machine_images.list_publishers( location="str", - publisher_name="str", - offer="str", - skus="str", api_version="2024-11-01", ) @@ -61,9 +55,11 @@ def test_virtual_machine_images_list_offers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_list_publishers(self, resource_group): - response = self.client.virtual_machine_images.list_publishers( + def test_virtual_machine_images_list_skus(self, resource_group): + response = self.client.virtual_machine_images.list_skus( location="str", + publisher_name="str", + offer="str", api_version="2024-11-01", ) @@ -72,11 +68,12 @@ def test_virtual_machine_images_list_publishers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_list_skus(self, resource_group): - response = self.client.virtual_machine_images.list_skus( + def test_virtual_machine_images_list(self, resource_group): + response = self.client.virtual_machine_images.list( location="str", publisher_name="str", offer="str", + skus="str", api_version="2024-11-01", ) @@ -85,10 +82,13 @@ def test_virtual_machine_images_list_skus(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_images_list_by_edge_zone(self, resource_group): - response = self.client.virtual_machine_images.list_by_edge_zone( + def test_virtual_machine_images_get(self, resource_group): + response = self.client.virtual_machine_images.get( location="str", - edge_zone="str", + publisher_name="str", + offer="str", + skus="str", + version="str", api_version="2024-11-01", ) diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations_async.py index 5d1fd72b1588..cff41cf4d345 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_images_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -21,13 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_get(self, resource_group): - response = await self.client.virtual_machine_images.get( + async def test_virtual_machine_images_list_by_edge_zone(self, resource_group): + response = await self.client.virtual_machine_images.list_by_edge_zone( location="str", - publisher_name="str", - offer="str", - skus="str", - version="str", + edge_zone="str", api_version="2024-11-01", ) @@ -36,12 +33,9 @@ async def test_virtual_machine_images_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_list(self, resource_group): - response = await self.client.virtual_machine_images.list( + async def test_virtual_machine_images_list_publishers(self, resource_group): + response = await self.client.virtual_machine_images.list_publishers( location="str", - publisher_name="str", - offer="str", - skus="str", api_version="2024-11-01", ) @@ -62,9 +56,11 @@ async def test_virtual_machine_images_list_offers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_list_publishers(self, resource_group): - response = await self.client.virtual_machine_images.list_publishers( + async def test_virtual_machine_images_list_skus(self, resource_group): + response = await self.client.virtual_machine_images.list_skus( location="str", + publisher_name="str", + offer="str", api_version="2024-11-01", ) @@ -73,11 +69,12 @@ async def test_virtual_machine_images_list_publishers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_list_skus(self, resource_group): - response = await self.client.virtual_machine_images.list_skus( + async def test_virtual_machine_images_list(self, resource_group): + response = await self.client.virtual_machine_images.list( location="str", publisher_name="str", offer="str", + skus="str", api_version="2024-11-01", ) @@ -86,10 +83,13 @@ async def test_virtual_machine_images_list_skus(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_images_list_by_edge_zone(self, resource_group): - response = await self.client.virtual_machine_images.list_by_edge_zone( + async def test_virtual_machine_images_get(self, resource_group): + response = await self.client.virtual_machine_images.get( location="str", - edge_zone="str", + publisher_name="str", + offer="str", + skus="str", + version="str", api_version="2024-11-01", ) diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations.py index caf662e06726..d52d6464f09f 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -41,6 +41,31 @@ def test_virtual_machine_run_commands_get(self, resource_group): # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_run_commands_list_by_virtual_machine(self, resource_group): + response = self.client.virtual_machine_run_commands.list_by_virtual_machine( + resource_group_name=resource_group.name, + vm_name="str", + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_run_commands_get_by_virtual_machine(self, resource_group): + response = self.client.virtual_machine_run_commands.get_by_virtual_machine( + resource_group_name=resource_group.name, + vm_name="str", + run_command_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_virtual_machine_run_commands_begin_create_or_update(self, resource_group): @@ -50,7 +75,7 @@ def test_virtual_machine_run_commands_begin_create_or_update(self, resource_grou run_command_name="str", run_command={ "location": "str", - "asyncExecution": False, + "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "errorBlobUri": "str", "id": "str", @@ -86,9 +111,17 @@ def test_virtual_machine_run_commands_begin_create_or_update(self, resource_grou "scriptUri": "str", "scriptUriManagedIdentity": {"clientId": "str", "objectId": "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"}, "timeoutInSeconds": 0, - "treatFailureAsDeploymentFailure": False, + "treatFailureAsDeploymentFailure": bool, "type": "str", }, api_version="2024-11-01", @@ -105,7 +138,7 @@ def test_virtual_machine_run_commands_begin_update(self, resource_group): vm_name="str", run_command_name="str", run_command={ - "asyncExecution": False, + "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "errorBlobUri": "str", "instanceView": { @@ -141,7 +174,7 @@ def test_virtual_machine_run_commands_begin_update(self, resource_group): }, "tags": {"str": "str"}, "timeoutInSeconds": 0, - "treatFailureAsDeploymentFailure": False, + "treatFailureAsDeploymentFailure": bool, }, api_version="2024-11-01", ).result() # call '.result()' to poll until service return final result @@ -161,28 +194,3 @@ def test_virtual_machine_run_commands_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_run_commands_get_by_virtual_machine(self, resource_group): - response = self.client.virtual_machine_run_commands.get_by_virtual_machine( - resource_group_name=resource_group.name, - vm_name="str", - run_command_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_run_commands_list_by_virtual_machine(self, resource_group): - response = self.client.virtual_machine_run_commands.list_by_virtual_machine( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations_async.py index a98c78cd9e3c..f8699fe05ff5 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_run_commands_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -42,6 +42,31 @@ async def test_virtual_machine_run_commands_get(self, resource_group): # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_run_commands_list_by_virtual_machine(self, resource_group): + response = self.client.virtual_machine_run_commands.list_by_virtual_machine( + resource_group_name=resource_group.name, + vm_name="str", + api_version="2024-11-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_virtual_machine_run_commands_get_by_virtual_machine(self, resource_group): + response = await self.client.virtual_machine_run_commands.get_by_virtual_machine( + resource_group_name=resource_group.name, + vm_name="str", + run_command_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_virtual_machine_run_commands_begin_create_or_update(self, resource_group): @@ -52,7 +77,7 @@ async def test_virtual_machine_run_commands_begin_create_or_update(self, resourc run_command_name="str", run_command={ "location": "str", - "asyncExecution": False, + "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "errorBlobUri": "str", "id": "str", @@ -88,9 +113,17 @@ async def test_virtual_machine_run_commands_begin_create_or_update(self, resourc "scriptUri": "str", "scriptUriManagedIdentity": {"clientId": "str", "objectId": "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"}, "timeoutInSeconds": 0, - "treatFailureAsDeploymentFailure": False, + "treatFailureAsDeploymentFailure": bool, "type": "str", }, api_version="2024-11-01", @@ -109,7 +142,7 @@ async def test_virtual_machine_run_commands_begin_update(self, resource_group): vm_name="str", run_command_name="str", run_command={ - "asyncExecution": False, + "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "errorBlobUri": "str", "instanceView": { @@ -145,7 +178,7 @@ async def test_virtual_machine_run_commands_begin_update(self, resource_group): }, "tags": {"str": "str"}, "timeoutInSeconds": 0, - "treatFailureAsDeploymentFailure": False, + "treatFailureAsDeploymentFailure": bool, }, api_version="2024-11-01", ) @@ -168,28 +201,3 @@ async def test_virtual_machine_run_commands_begin_delete(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_run_commands_get_by_virtual_machine(self, resource_group): - response = await self.client.virtual_machine_run_commands.get_by_virtual_machine( - resource_group_name=resource_group.name, - vm_name="str", - run_command_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_run_commands_list_by_virtual_machine(self, resource_group): - response = self.client.virtual_machine_run_commands.list_by_virtual_machine( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2024-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations.py index 03e5d61f5908..3a99b58c1e21 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,31 @@ class TestComputeManagementVirtualMachineScaleSetExtensionsOperations(AzureMgmtR def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_extensions_list(self, resource_group): + response = self.client.virtual_machine_scale_set_extensions.list( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_extensions_get(self, resource_group): + response = self.client.virtual_machine_scale_set_extensions.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + vmss_extension_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_virtual_machine_scale_set_extensions_begin_create_or_update(self, resource_group): @@ -88,28 +113,3 @@ def test_virtual_machine_scale_set_extensions_begin_delete(self, resource_group) # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_extensions_get(self, resource_group): - response = self.client.virtual_machine_scale_set_extensions.get( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - vmss_extension_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_extensions_list(self, resource_group): - response = self.client.virtual_machine_scale_set_extensions.list( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations_async.py index 455263a801a7..bcaf9d0a5bad 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_extensions_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,31 @@ class TestComputeManagementVirtualMachineScaleSetExtensionsOperationsAsync(Azure def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_extensions_list(self, resource_group): + response = self.client.virtual_machine_scale_set_extensions.list( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + api_version="2024-11-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_virtual_machine_scale_set_extensions_get(self, resource_group): + response = await self.client.virtual_machine_scale_set_extensions.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + vmss_extension_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_virtual_machine_scale_set_extensions_begin_create_or_update(self, resource_group): @@ -95,28 +120,3 @@ async def test_virtual_machine_scale_set_extensions_begin_delete(self, resource_ # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_extensions_get(self, resource_group): - response = await self.client.virtual_machine_scale_set_extensions.get( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - vmss_extension_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_extensions_list(self, resource_group): - response = self.client.virtual_machine_scale_set_extensions.list( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2024-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations.py index 05546f2e3698..3624654ca3cf 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -20,8 +20,8 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_set_rolling_upgrades_begin_cancel(self, resource_group): - response = self.client.virtual_machine_scale_set_rolling_upgrades.begin_cancel( + def test_virtual_machine_scale_set_rolling_upgrades_begin_start_extension_upgrade(self, resource_group): + response = self.client.virtual_machine_scale_set_rolling_upgrades.begin_start_extension_upgrade( resource_group_name=resource_group.name, vm_scale_set_name="str", api_version="2024-11-01", @@ -44,8 +44,8 @@ def test_virtual_machine_scale_set_rolling_upgrades_begin_start_os_upgrade(self, @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_set_rolling_upgrades_begin_start_extension_upgrade(self, resource_group): - response = self.client.virtual_machine_scale_set_rolling_upgrades.begin_start_extension_upgrade( + def test_virtual_machine_scale_set_rolling_upgrades_begin_cancel(self, resource_group): + response = self.client.virtual_machine_scale_set_rolling_upgrades.begin_cancel( resource_group_name=resource_group.name, vm_scale_set_name="str", api_version="2024-11-01", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations_async.py index b750272734f1..e6ebbd70a669 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_rolling_upgrades_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_set_rolling_upgrades_begin_cancel(self, resource_group): + async def test_virtual_machine_scale_set_rolling_upgrades_begin_start_extension_upgrade(self, resource_group): response = await ( - await self.client.virtual_machine_scale_set_rolling_upgrades.begin_cancel( + await self.client.virtual_machine_scale_set_rolling_upgrades.begin_start_extension_upgrade( resource_group_name=resource_group.name, vm_scale_set_name="str", api_version="2024-11-01", @@ -49,9 +49,9 @@ async def test_virtual_machine_scale_set_rolling_upgrades_begin_start_os_upgrade @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_set_rolling_upgrades_begin_start_extension_upgrade(self, resource_group): + async def test_virtual_machine_scale_set_rolling_upgrades_begin_cancel(self, resource_group): response = await ( - await self.client.virtual_machine_scale_set_rolling_upgrades.begin_start_extension_upgrade( + await self.client.virtual_machine_scale_set_rolling_upgrades.begin_cancel( resource_group_name=resource_group.name, vm_scale_set_name="str", api_version="2024-11-01", diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations.py index 96bb5a01f81b..652215072c5e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,33 @@ class TestComputeManagementVirtualMachineScaleSetVMExtensionsOperations(AzureMgm def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_extensions_list(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_extensions.list( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_extensions_get(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_extensions.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + vm_extension_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_virtual_machine_scale_set_vm_extensions_begin_create_or_update(self, resource_group): @@ -113,30 +140,3 @@ def test_virtual_machine_scale_set_vm_extensions_begin_delete(self, resource_gro # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_extensions_get(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_extensions.get( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - vm_extension_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_extensions_list(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_extensions.list( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations_async.py index 45821c887e5b..f7f02c624fe9 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_extensions_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,33 @@ class TestComputeManagementVirtualMachineScaleSetVMExtensionsOperationsAsync(Azu def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_extensions_list(self, resource_group): + response = await self.client.virtual_machine_scale_set_vm_extensions.list( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_extensions_get(self, resource_group): + response = await self.client.virtual_machine_scale_set_vm_extensions.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + vm_extension_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_virtual_machine_scale_set_vm_extensions_begin_create_or_update(self, resource_group): @@ -120,30 +147,3 @@ async def test_virtual_machine_scale_set_vm_extensions_begin_delete(self, resour # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_extensions_get(self, resource_group): - response = await self.client.virtual_machine_scale_set_vm_extensions.get( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - vm_extension_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_extensions_list(self, resource_group): - response = await self.client.virtual_machine_scale_set_vm_extensions.list( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations.py index 50cf9f96b1a7..3ddb97403784 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,6 +18,33 @@ class TestComputeManagementVirtualMachineScaleSetVMRunCommandsOperations(AzureMg def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_run_commands_list(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_run_commands.list( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_vm_run_commands_get(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_run_commands.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + run_command_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update(self, resource_group): @@ -28,7 +55,7 @@ def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update(self, run_command_name="str", run_command={ "location": "str", - "asyncExecution": False, + "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "errorBlobUri": "str", "id": "str", @@ -64,9 +91,17 @@ def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update(self, "scriptUri": "str", "scriptUriManagedIdentity": {"clientId": "str", "objectId": "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"}, "timeoutInSeconds": 0, - "treatFailureAsDeploymentFailure": False, + "treatFailureAsDeploymentFailure": bool, "type": "str", }, api_version="2024-11-01", @@ -84,7 +119,7 @@ def test_virtual_machine_scale_set_vm_run_commands_begin_update(self, resource_g instance_id="str", run_command_name="str", run_command={ - "asyncExecution": False, + "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "errorBlobUri": "str", "instanceView": { @@ -120,7 +155,7 @@ def test_virtual_machine_scale_set_vm_run_commands_begin_update(self, resource_g }, "tags": {"str": "str"}, "timeoutInSeconds": 0, - "treatFailureAsDeploymentFailure": False, + "treatFailureAsDeploymentFailure": bool, }, api_version="2024-11-01", ).result() # call '.result()' to poll until service return final result @@ -141,30 +176,3 @@ def test_virtual_machine_scale_set_vm_run_commands_begin_delete(self, resource_g # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_run_commands_get(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_run_commands.get( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - run_command_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_set_vm_run_commands_list(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_run_commands.list( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations_async.py index fe9943a7b934..7dd4f1a50a94 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vm_run_commands_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,6 +19,33 @@ class TestComputeManagementVirtualMachineScaleSetVMRunCommandsOperationsAsync(Az def setup_method(self, method): self.client = self.create_mgmt_client(ComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_set_vm_run_commands_list(self, resource_group): + response = self.client.virtual_machine_scale_set_vm_run_commands.list( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + api_version="2024-11-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_virtual_machine_scale_set_vm_run_commands_get(self, resource_group): + response = await self.client.virtual_machine_scale_set_vm_run_commands.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + run_command_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update(self, resource_group): @@ -30,7 +57,7 @@ async def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update( run_command_name="str", run_command={ "location": "str", - "asyncExecution": False, + "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "errorBlobUri": "str", "id": "str", @@ -66,9 +93,17 @@ async def test_virtual_machine_scale_set_vm_run_commands_begin_create_or_update( "scriptUri": "str", "scriptUriManagedIdentity": {"clientId": "str", "objectId": "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"}, "timeoutInSeconds": 0, - "treatFailureAsDeploymentFailure": False, + "treatFailureAsDeploymentFailure": bool, "type": "str", }, api_version="2024-11-01", @@ -88,7 +123,7 @@ async def test_virtual_machine_scale_set_vm_run_commands_begin_update(self, reso instance_id="str", run_command_name="str", run_command={ - "asyncExecution": False, + "asyncExecution": bool, "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, "errorBlobUri": "str", "instanceView": { @@ -124,7 +159,7 @@ async def test_virtual_machine_scale_set_vm_run_commands_begin_update(self, reso }, "tags": {"str": "str"}, "timeoutInSeconds": 0, - "treatFailureAsDeploymentFailure": False, + "treatFailureAsDeploymentFailure": bool, }, api_version="2024-11-01", ) @@ -148,30 +183,3 @@ async def test_virtual_machine_scale_set_vm_run_commands_begin_delete(self, reso # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_run_commands_get(self, resource_group): - response = await self.client.virtual_machine_scale_set_vm_run_commands.get( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - run_command_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vm_run_commands_list(self, resource_group): - response = self.client.virtual_machine_scale_set_vm_run_commands.list( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2024-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations.py index 8c93f7e6640a..881b1ffe7e09 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -20,52 +20,25 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_reimage(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_reimage( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2024-11-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_virtual_machine_scale_set_vms_begin_reimage_all(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_reimage_all( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2024-11-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_virtual_machine_scale_set_vms_begin_approve_rolling_upgrade(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_approve_rolling_upgrade( + def test_virtual_machine_scale_set_vms_list(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.list( resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", + virtual_machine_scale_set_name="str", api_version="2024-11-01", - ).result() # call '.result()' to poll until service return final result - + ) + result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_deallocate(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_deallocate( + def test_virtual_machine_scale_set_vms_get(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.get( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", api_version="2024-11-01", - ).result() # call '.result()' to poll until service return final result + ) # please add some check logic here by yourself # ... @@ -355,6 +328,7 @@ def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): "resilientVMDeletionStatus": "str", "resources": [ { + "location": "str", "autoUpgradeMinorVersion": bool, "enableAutomaticUpgrade": bool, "forceUpdateTag": "str", @@ -382,7 +356,6 @@ def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): "type": "str", "typeHandlerVersion": "str", }, - "location": "str", "name": "str", "protectedSettings": {}, "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, @@ -391,6 +364,14 @@ def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): "publisher": "str", "settings": {}, "suppressFailures": bool, + "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", "typeHandlerVersion": "str", @@ -474,6 +455,14 @@ def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): "writeAcceleratorEnabled": bool, }, }, + "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"}, "timeCreated": "2020-02-20 00:00:00", "type": "str", @@ -502,59 +491,73 @@ def test_virtual_machine_scale_set_vms_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_set_vms_get(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.get( + def test_virtual_machine_scale_set_vms_begin_approve_rolling_upgrade(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_approve_rolling_upgrade( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", api_version="2024-11-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_virtual_machine_scale_set_vms_get_instance_view(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.get_instance_view( + def test_virtual_machine_scale_set_vms_begin_attach_detach_data_disks(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_attach_detach_data_disks( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", + parameters={ + "dataDisksToAttach": [ + { + "diskId": "str", + "caching": "str", + "deleteOption": "str", + "diskEncryptionSet": {"id": "str"}, + "lun": 0, + "writeAcceleratorEnabled": bool, + } + ], + "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], + }, api_version="2024-11-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_virtual_machine_scale_set_vms_list(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.list( + def test_virtual_machine_scale_set_vms_begin_deallocate(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_deallocate( resource_group_name=resource_group.name, - virtual_machine_scale_set_name="str", + vm_scale_set_name="str", + instance_id="str", api_version="2024-11-01", - ) - result = [r for r in response] + ).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_virtual_machine_scale_set_vms_begin_power_off(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_power_off( + def test_virtual_machine_scale_set_vms_get_instance_view(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.get_instance_view( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", api_version="2024-11-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_virtual_machine_scale_set_vms_begin_restart(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_restart( + def test_virtual_machine_scale_set_vms_begin_perform_maintenance(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_perform_maintenance( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", @@ -566,8 +569,8 @@ def test_virtual_machine_scale_set_vms_begin_restart(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_set_vms_begin_start(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_start( + def test_virtual_machine_scale_set_vms_begin_power_off(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_power_off( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", @@ -592,21 +595,21 @@ def test_virtual_machine_scale_set_vms_begin_redeploy(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.retrieve_boot_diagnostics_data( + def test_virtual_machine_scale_set_vms_begin_reimage(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_reimage( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", api_version="2024-11-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_virtual_machine_scale_set_vms_begin_perform_maintenance(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_perform_maintenance( + def test_virtual_machine_scale_set_vms_begin_reimage_all(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_reimage_all( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", @@ -618,39 +621,26 @@ def test_virtual_machine_scale_set_vms_begin_perform_maintenance(self, resource_ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_set_vms_simulate_eviction(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.simulate_eviction( + def test_virtual_machine_scale_set_vms_begin_restart(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_restart( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", api_version="2024-11-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_virtual_machine_scale_set_vms_begin_attach_detach_data_disks(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.begin_attach_detach_data_disks( + def test_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.retrieve_boot_diagnostics_data( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - parameters={ - "dataDisksToAttach": [ - { - "diskId": "str", - "caching": "str", - "deleteOption": "str", - "diskEncryptionSet": {"id": "str"}, - "lun": 0, - "writeAcceleratorEnabled": bool, - } - ], - "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], - }, api_version="2024-11-01", - ).result() # call '.result()' to poll until service return final result + ) # please add some check logic here by yourself # ... @@ -668,3 +658,29 @@ def test_virtual_machine_scale_set_vms_begin_run_command(self, resource_group): # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_simulate_eviction(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.simulate_eviction( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_set_vms_begin_start(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.begin_start( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + api_version="2024-11-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations_async.py index 855c34b4315f..18032ce234eb 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_set_vms_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -21,60 +21,25 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_reimage(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_reimage( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2024-11-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_virtual_machine_scale_set_vms_begin_reimage_all(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_reimage_all( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2024-11-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_virtual_machine_scale_set_vms_begin_approve_rolling_upgrade(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_approve_rolling_upgrade( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2024-11-01", - ) - ).result() # call '.result()' to poll until service return final result - + async def test_virtual_machine_scale_set_vms_list(self, resource_group): + response = self.client.virtual_machine_scale_set_vms.list( + resource_group_name=resource_group.name, + virtual_machine_scale_set_name="str", + api_version="2024-11-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_virtual_machine_scale_set_vms_begin_deallocate(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_deallocate( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2024-11-01", - ) - ).result() # call '.result()' to poll until service return final result + async def test_virtual_machine_scale_set_vms_get(self, resource_group): + response = await self.client.virtual_machine_scale_set_vms.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + api_version="2024-11-01", + ) # please add some check logic here by yourself # ... @@ -365,6 +330,7 @@ async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): "resilientVMDeletionStatus": "str", "resources": [ { + "location": "str", "autoUpgradeMinorVersion": bool, "enableAutomaticUpgrade": bool, "forceUpdateTag": "str", @@ -392,7 +358,6 @@ async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): "type": "str", "typeHandlerVersion": "str", }, - "location": "str", "name": "str", "protectedSettings": {}, "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, @@ -401,6 +366,14 @@ async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): "publisher": "str", "settings": {}, "suppressFailures": bool, + "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", "typeHandlerVersion": "str", @@ -487,6 +460,14 @@ async def test_virtual_machine_scale_set_vms_begin_update(self, resource_group): "writeAcceleratorEnabled": bool, }, }, + "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"}, "timeCreated": "2020-02-20 00:00:00", "type": "str", @@ -518,13 +499,58 @@ async def test_virtual_machine_scale_set_vms_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_get(self, resource_group): - response = await self.client.virtual_machine_scale_set_vms.get( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - api_version="2024-11-01", - ) + async def test_virtual_machine_scale_set_vms_begin_approve_rolling_upgrade(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_approve_rolling_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + api_version="2024-11-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_virtual_machine_scale_set_vms_begin_attach_detach_data_disks(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_attach_detach_data_disks( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + parameters={ + "dataDisksToAttach": [ + { + "diskId": "str", + "caching": "str", + "deleteOption": "str", + "diskEncryptionSet": {"id": "str"}, + "lun": 0, + "writeAcceleratorEnabled": bool, + } + ], + "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], + }, + api_version="2024-11-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_virtual_machine_scale_set_vms_begin_deallocate(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_deallocate( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + api_version="2024-11-01", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @@ -544,13 +570,16 @@ async def test_virtual_machine_scale_set_vms_get_instance_view(self, resource_gr @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_list(self, resource_group): - response = self.client.virtual_machine_scale_set_vms.list( - resource_group_name=resource_group.name, - virtual_machine_scale_set_name="str", - api_version="2024-11-01", - ) - result = [r async for r in response] + async def test_virtual_machine_scale_set_vms_begin_perform_maintenance(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_perform_maintenance( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + api_version="2024-11-01", + ) + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... @@ -571,9 +600,9 @@ async def test_virtual_machine_scale_set_vms_begin_power_off(self, resource_grou @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_restart(self, resource_group): + async def test_virtual_machine_scale_set_vms_begin_redeploy(self, resource_group): response = await ( - await self.client.virtual_machine_scale_set_vms.begin_restart( + await self.client.virtual_machine_scale_set_vms.begin_redeploy( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", @@ -586,9 +615,9 @@ async def test_virtual_machine_scale_set_vms_begin_restart(self, resource_group) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_start(self, resource_group): + async def test_virtual_machine_scale_set_vms_begin_reimage(self, resource_group): response = await ( - await self.client.virtual_machine_scale_set_vms.begin_start( + await self.client.virtual_machine_scale_set_vms.begin_reimage( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", @@ -601,9 +630,24 @@ async def test_virtual_machine_scale_set_vms_begin_start(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_redeploy(self, resource_group): + async def test_virtual_machine_scale_set_vms_begin_reimage_all(self, resource_group): response = await ( - await self.client.virtual_machine_scale_set_vms.begin_redeploy( + await self.client.virtual_machine_scale_set_vms.begin_reimage_all( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + instance_id="str", + api_version="2024-11-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_virtual_machine_scale_set_vms_begin_restart(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_set_vms.begin_restart( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", @@ -629,12 +673,13 @@ async def test_virtual_machine_scale_set_vms_retrieve_boot_diagnostics_data(self @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_perform_maintenance(self, resource_group): + async def test_virtual_machine_scale_set_vms_begin_run_command(self, resource_group): response = await ( - await self.client.virtual_machine_scale_set_vms.begin_perform_maintenance( + await self.client.virtual_machine_scale_set_vms.begin_run_command( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", + parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, api_version="2024-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -657,41 +702,12 @@ async def test_virtual_machine_scale_set_vms_simulate_eviction(self, resource_gr @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_set_vms_begin_attach_detach_data_disks(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_set_vms.begin_attach_detach_data_disks( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - instance_id="str", - parameters={ - "dataDisksToAttach": [ - { - "diskId": "str", - "caching": "str", - "deleteOption": "str", - "diskEncryptionSet": {"id": "str"}, - "lun": 0, - "writeAcceleratorEnabled": bool, - } - ], - "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], - }, - api_version="2024-11-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_virtual_machine_scale_set_vms_begin_run_command(self, resource_group): + async def test_virtual_machine_scale_set_vms_begin_start(self, resource_group): response = await ( - await self.client.virtual_machine_scale_set_vms.begin_run_command( + await self.client.virtual_machine_scale_set_vms.begin_start( resource_group_name=resource_group.name, vm_scale_set_name="str", instance_id="str", - parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, api_version="2024-11-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations.py index 2e36cf50457c..1d32f10572bd 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -29,6 +29,39 @@ def test_virtual_machine_scale_sets_list_by_location(self, resource_group): # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_sets_list_all(self, resource_group): + response = self.client.virtual_machine_scale_sets.list_all( + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_sets_list(self, resource_group): + response = self.client.virtual_machine_scale_sets.list( + resource_group_name=resource_group.name, + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_scale_sets_get(self, resource_group): + response = self.client.virtual_machine_scale_sets.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_group): @@ -78,6 +111,14 @@ def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_group) "sku": {"capacity": 0, "name": "str", "tier": "str"}, "skuProfile": {"allocationStrategy": "str", "vmSizes": [{"name": "str", "rank": 0}]}, "spotRestorePolicy": {"enabled": bool, "restoreTimeout": "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"}, "timeCreated": "2020-02-20 00:00:00", "type": "str", @@ -580,11 +621,24 @@ def test_virtual_machine_scale_sets_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_sets_get(self, resource_group): - response = self.client.virtual_machine_scale_sets.get( + def test_virtual_machine_scale_sets_begin_approve_rolling_upgrade(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_approve_rolling_upgrade( resource_group_name=resource_group.name, vm_scale_set_name="str", api_version="2024-11-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_virtual_machine_scale_sets_convert_to_single_placement_group(self, resource_group): + response = self.client.virtual_machine_scale_sets.convert_to_single_placement_group( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + parameters={"activePlacementGroupId": "str"}, + api_version="2024-11-01", ) # please add some check logic here by yourself @@ -617,10 +671,11 @@ def test_virtual_machine_scale_sets_begin_delete_instances(self, resource_group) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_sets_get_instance_view(self, resource_group): - response = self.client.virtual_machine_scale_sets.get_instance_view( + def test_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk(self, resource_group): + response = self.client.virtual_machine_scale_sets.force_recovery_service_fabric_platform_update_domain_walk( resource_group_name=resource_group.name, vm_scale_set_name="str", + platform_update_domain=0, api_version="2024-11-01", ) @@ -629,34 +684,26 @@ def test_virtual_machine_scale_sets_get_instance_view(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_sets_list(self, resource_group): - response = self.client.virtual_machine_scale_sets.list( + def test_virtual_machine_scale_sets_get_instance_view(self, resource_group): + response = self.client.virtual_machine_scale_sets.get_instance_view( resource_group_name=resource_group.name, + vm_scale_set_name="str", api_version="2024-11-01", ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_list_all(self, resource_group): - response = self.client.virtual_machine_scale_sets.list_all( - api_version="2024-11-01", - ) - result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_sets_list_skus(self, resource_group): - response = self.client.virtual_machine_scale_sets.list_skus( + def test_virtual_machine_scale_sets_begin_update_instances(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_update_instances( resource_group_name=resource_group.name, vm_scale_set_name="str", + vm_instance_i_ds={"instanceIds": ["str"]}, api_version="2024-11-01", - ) - result = [r for r in response] + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... @@ -674,20 +721,8 @@ def test_virtual_machine_scale_sets_get_os_upgrade_history(self, resource_group) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_power_off(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_power_off( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2024-11-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_virtual_machine_scale_sets_begin_restart(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_restart( + def test_virtual_machine_scale_sets_begin_perform_maintenance(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_perform_maintenance( resource_group_name=resource_group.name, vm_scale_set_name="str", api_version="2024-11-01", @@ -698,8 +733,8 @@ def test_virtual_machine_scale_sets_begin_restart(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_start(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_start( + def test_virtual_machine_scale_sets_begin_power_off(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_power_off( resource_group_name=resource_group.name, vm_scale_set_name="str", api_version="2024-11-01", @@ -732,31 +767,6 @@ def test_virtual_machine_scale_sets_begin_redeploy(self, resource_group): # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_perform_maintenance(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_perform_maintenance( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2024-11-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_virtual_machine_scale_sets_begin_update_instances(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_update_instances( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - vm_instance_i_ds={"instanceIds": ["str"]}, - api_version="2024-11-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_virtual_machine_scale_sets_begin_reimage(self, resource_group): @@ -783,8 +793,8 @@ def test_virtual_machine_scale_sets_begin_reimage_all(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_approve_rolling_upgrade(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_approve_rolling_upgrade( + def test_virtual_machine_scale_sets_begin_restart(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_restart( resource_group_name=resource_group.name, vm_scale_set_name="str", api_version="2024-11-01", @@ -795,37 +805,35 @@ def test_virtual_machine_scale_sets_begin_approve_rolling_upgrade(self, resource @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk(self, resource_group): - response = self.client.virtual_machine_scale_sets.force_recovery_service_fabric_platform_update_domain_walk( + def test_virtual_machine_scale_sets_begin_set_orchestration_service_state(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_set_orchestration_service_state( resource_group_name=resource_group.name, vm_scale_set_name="str", - platform_update_domain=0, + parameters={"action": "str", "serviceName": "str"}, api_version="2024-11-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_virtual_machine_scale_sets_convert_to_single_placement_group(self, resource_group): - response = self.client.virtual_machine_scale_sets.convert_to_single_placement_group( + def test_virtual_machine_scale_sets_list_skus(self, resource_group): + response = self.client.virtual_machine_scale_sets.list_skus( resource_group_name=resource_group.name, vm_scale_set_name="str", - parameters={"activePlacementGroupId": "str"}, api_version="2024-11-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machine_scale_sets_begin_set_orchestration_service_state(self, resource_group): - response = self.client.virtual_machine_scale_sets.begin_set_orchestration_service_state( + def test_virtual_machine_scale_sets_begin_start(self, resource_group): + response = self.client.virtual_machine_scale_sets.begin_start( resource_group_name=resource_group.name, vm_scale_set_name="str", - parameters={"action": "str", "serviceName": "str"}, api_version="2024-11-01", ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations_async.py index 3dba0dcf6a01..7a9395aaff75 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_scale_sets_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -30,6 +30,39 @@ async def test_virtual_machine_scale_sets_list_by_location(self, resource_group) # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_scale_sets_list_all(self, resource_group): + response = self.client.virtual_machine_scale_sets.list_all( + api_version="2024-11-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_virtual_machine_scale_sets_list(self, resource_group): + response = self.client.virtual_machine_scale_sets.list( + resource_group_name=resource_group.name, + api_version="2024-11-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_virtual_machine_scale_sets_get(self, resource_group): + response = await self.client.virtual_machine_scale_sets.get( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + api_version="2024-11-01", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_group): @@ -80,6 +113,14 @@ async def test_virtual_machine_scale_sets_begin_create_or_update(self, resource_ "sku": {"capacity": 0, "name": "str", "tier": "str"}, "skuProfile": {"allocationStrategy": "str", "vmSizes": [{"name": "str", "rank": 0}]}, "spotRestorePolicy": {"enabled": bool, "restoreTimeout": "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"}, "timeCreated": "2020-02-20 00:00:00", "type": "str", @@ -593,10 +634,25 @@ async def test_virtual_machine_scale_sets_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_get(self, resource_group): - response = await self.client.virtual_machine_scale_sets.get( + async def test_virtual_machine_scale_sets_begin_approve_rolling_upgrade(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_approve_rolling_upgrade( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + api_version="2024-11-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_virtual_machine_scale_sets_convert_to_single_placement_group(self, resource_group): + response = await self.client.virtual_machine_scale_sets.convert_to_single_placement_group( resource_group_name=resource_group.name, vm_scale_set_name="str", + parameters={"activePlacementGroupId": "str"}, api_version="2024-11-01", ) @@ -634,11 +690,16 @@ async def test_virtual_machine_scale_sets_begin_delete_instances(self, resource_ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_get_instance_view(self, resource_group): - response = await self.client.virtual_machine_scale_sets.get_instance_view( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2024-11-01", + async def test_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk( + self, resource_group + ): + response = ( + await self.client.virtual_machine_scale_sets.force_recovery_service_fabric_platform_update_domain_walk( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + platform_update_domain=0, + api_version="2024-11-01", + ) ) # please add some check logic here by yourself @@ -646,34 +707,28 @@ async def test_virtual_machine_scale_sets_get_instance_view(self, resource_group @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_list(self, resource_group): - response = self.client.virtual_machine_scale_sets.list( + async def test_virtual_machine_scale_sets_get_instance_view(self, resource_group): + response = await self.client.virtual_machine_scale_sets.get_instance_view( resource_group_name=resource_group.name, + vm_scale_set_name="str", api_version="2024-11-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_virtual_machine_scale_sets_list_all(self, resource_group): - response = self.client.virtual_machine_scale_sets.list_all( - api_version="2024-11-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_virtual_machine_scale_sets_list_skus(self, resource_group): - response = self.client.virtual_machine_scale_sets.list_skus( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2024-11-01", - ) - result = [r async for r in response] + async def test_virtual_machine_scale_sets_begin_update_instances(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_update_instances( + resource_group_name=resource_group.name, + vm_scale_set_name="str", + vm_instance_i_ds={"instanceIds": ["str"]}, + api_version="2024-11-01", + ) + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... @@ -691,23 +746,9 @@ async def test_virtual_machine_scale_sets_get_os_upgrade_history(self, resource_ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_power_off(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_power_off( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2024-11-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_virtual_machine_scale_sets_begin_restart(self, resource_group): + async def test_virtual_machine_scale_sets_begin_perform_maintenance(self, resource_group): response = await ( - await self.client.virtual_machine_scale_sets.begin_restart( + await self.client.virtual_machine_scale_sets.begin_perform_maintenance( resource_group_name=resource_group.name, vm_scale_set_name="str", api_version="2024-11-01", @@ -719,9 +760,9 @@ async def test_virtual_machine_scale_sets_begin_restart(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_start(self, resource_group): + async def test_virtual_machine_scale_sets_begin_power_off(self, resource_group): response = await ( - await self.client.virtual_machine_scale_sets.begin_start( + await self.client.virtual_machine_scale_sets.begin_power_off( resource_group_name=resource_group.name, vm_scale_set_name="str", api_version="2024-11-01", @@ -759,35 +800,6 @@ async def test_virtual_machine_scale_sets_begin_redeploy(self, resource_group): # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_perform_maintenance(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_perform_maintenance( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - api_version="2024-11-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_virtual_machine_scale_sets_begin_update_instances(self, resource_group): - response = await ( - await self.client.virtual_machine_scale_sets.begin_update_instances( - resource_group_name=resource_group.name, - vm_scale_set_name="str", - vm_instance_i_ds={"instanceIds": ["str"]}, - api_version="2024-11-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_virtual_machine_scale_sets_begin_reimage(self, resource_group): @@ -818,9 +830,9 @@ async def test_virtual_machine_scale_sets_begin_reimage_all(self, resource_group @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_begin_approve_rolling_upgrade(self, resource_group): + async def test_virtual_machine_scale_sets_begin_restart(self, resource_group): response = await ( - await self.client.virtual_machine_scale_sets.begin_approve_rolling_upgrade( + await self.client.virtual_machine_scale_sets.begin_restart( resource_group_name=resource_group.name, vm_scale_set_name="str", api_version="2024-11-01", @@ -832,42 +844,38 @@ async def test_virtual_machine_scale_sets_begin_approve_rolling_upgrade(self, re @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machine_scale_sets_force_recovery_service_fabric_platform_update_domain_walk( - self, resource_group - ): - response = ( - await self.client.virtual_machine_scale_sets.force_recovery_service_fabric_platform_update_domain_walk( + async def test_virtual_machine_scale_sets_begin_set_orchestration_service_state(self, resource_group): + response = await ( + await self.client.virtual_machine_scale_sets.begin_set_orchestration_service_state( resource_group_name=resource_group.name, vm_scale_set_name="str", - platform_update_domain=0, + parameters={"action": "str", "serviceName": "str"}, api_version="2024-11-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_virtual_machine_scale_sets_convert_to_single_placement_group(self, resource_group): - response = await self.client.virtual_machine_scale_sets.convert_to_single_placement_group( + async def test_virtual_machine_scale_sets_list_skus(self, resource_group): + response = self.client.virtual_machine_scale_sets.list_skus( resource_group_name=resource_group.name, vm_scale_set_name="str", - parameters={"activePlacementGroupId": "str"}, api_version="2024-11-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_virtual_machine_scale_sets_begin_set_orchestration_service_state(self, resource_group): + async def test_virtual_machine_scale_sets_begin_start(self, resource_group): response = await ( - await self.client.virtual_machine_scale_sets.begin_set_orchestration_service_state( + await self.client.virtual_machine_scale_sets.begin_start( resource_group_name=resource_group.name, vm_scale_set_name="str", - parameters={"action": "str", "serviceName": "str"}, api_version="2024-11-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations.py index 30802dc0c73a..138b35591870 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations_async.py index e6bceb227f59..2829a3f46d52 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machine_sizes_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations.py index 39983f32d436..35bd8af9a0e3 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01 import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -31,13 +32,33 @@ def test_virtual_machines_list_by_location(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_begin_capture(self, resource_group): - response = self.client.virtual_machines.begin_capture( + def test_virtual_machines_list_all(self, resource_group): + response = self.client.virtual_machines.list_all( + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machines_list(self, resource_group): + response = self.client.virtual_machines.list( + resource_group_name=resource_group.name, + api_version="2024-11-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machines_get(self, resource_group): + response = self.client.virtual_machines.get( resource_group_name=resource_group.name, vm_name="str", - parameters={"destinationContainerName": "str", "overwriteVhds": bool, "vhdPrefix": "str"}, api_version="2024-11-01", - ).result() # call '.result()' to poll until service return final result + ) # please add some check logic here by yourself # ... @@ -352,6 +373,7 @@ def test_virtual_machines_begin_create_or_update(self, resource_group): "proximityPlacementGroup": {"id": "str"}, "resources": [ { + "location": "str", "autoUpgradeMinorVersion": bool, "enableAutomaticUpgrade": bool, "forceUpdateTag": "str", @@ -379,7 +401,6 @@ def test_virtual_machines_begin_create_or_update(self, resource_group): "type": "str", "typeHandlerVersion": "str", }, - "location": "str", "name": "str", "protectedSettings": {}, "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, @@ -388,6 +409,14 @@ def test_virtual_machines_begin_create_or_update(self, resource_group): "publisher": "str", "settings": {}, "suppressFailures": bool, + "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", "typeHandlerVersion": "str", @@ -479,6 +508,14 @@ def test_virtual_machines_begin_create_or_update(self, resource_group): "writeAcceleratorEnabled": bool, }, }, + "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"}, "timeCreated": "2020-02-20 00:00:00", "type": "str", @@ -907,24 +944,50 @@ def test_virtual_machines_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_get(self, resource_group): - response = self.client.virtual_machines.get( + def test_virtual_machines_begin_assess_patches(self, resource_group): + response = self.client.virtual_machines.begin_assess_patches( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-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_virtual_machines_instance_view(self, resource_group): - response = self.client.virtual_machines.instance_view( + def test_virtual_machines_begin_attach_detach_data_disks(self, resource_group): + response = self.client.virtual_machines.begin_attach_detach_data_disks( resource_group_name=resource_group.name, vm_name="str", + parameters={ + "dataDisksToAttach": [ + { + "diskId": "str", + "caching": "str", + "deleteOption": "str", + "diskEncryptionSet": {"id": "str"}, + "lun": 0, + "writeAcceleratorEnabled": bool, + } + ], + "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], + }, api_version="2024-11-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_virtual_machines_begin_capture(self, resource_group): + response = self.client.virtual_machines.begin_capture( + resource_group_name=resource_group.name, + vm_name="str", + parameters={"destinationContainerName": "str", "overwriteVhds": bool, "vhdPrefix": "str"}, + api_version="2024-11-01", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @@ -967,41 +1030,49 @@ def test_virtual_machines_generalize(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_list(self, resource_group): - response = self.client.virtual_machines.list( + def test_virtual_machines_begin_install_patches(self, resource_group): + response = self.client.virtual_machines.begin_install_patches( resource_group_name=resource_group.name, + vm_name="str", + install_patches_input={ + "rebootSetting": "str", + "linuxParameters": { + "classificationsToInclude": ["str"], + "maintenanceRunId": "str", + "packageNameMasksToExclude": ["str"], + "packageNameMasksToInclude": ["str"], + }, + "maximumDuration": "1 day, 0:00:00", + "windowsParameters": { + "classificationsToInclude": ["str"], + "excludeKbsRequiringReboot": bool, + "kbNumbersToExclude": ["str"], + "kbNumbersToInclude": ["str"], + "maxPatchPublishDate": "2020-02-20 00:00:00", + }, + }, api_version="2024-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + ).result() # call '.result()' to poll until service return final result - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_list_all(self, resource_group): - response = self.client.virtual_machines.list_all( - api_version="2024-11-01", - ) - result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_list_available_sizes(self, resource_group): - response = self.client.virtual_machines.list_available_sizes( + def test_virtual_machines_instance_view(self, resource_group): + response = self.client.virtual_machines.instance_view( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_begin_power_off(self, resource_group): - response = self.client.virtual_machines.begin_power_off( + def test_virtual_machines_begin_migrate_to_vm_scale_set(self, resource_group): + response = self.client.virtual_machines.begin_migrate_to_vm_scale_set( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1012,8 +1083,8 @@ def test_virtual_machines_begin_power_off(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_begin_reapply(self, resource_group): - response = self.client.virtual_machines.begin_reapply( + def test_virtual_machines_begin_perform_maintenance(self, resource_group): + response = self.client.virtual_machines.begin_perform_maintenance( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1024,8 +1095,8 @@ def test_virtual_machines_begin_reapply(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_begin_restart(self, resource_group): - response = self.client.virtual_machines.begin_restart( + def test_virtual_machines_begin_power_off(self, resource_group): + response = self.client.virtual_machines.begin_power_off( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1036,8 +1107,8 @@ def test_virtual_machines_begin_restart(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_begin_start(self, resource_group): - response = self.client.virtual_machines.begin_start( + def test_virtual_machines_begin_reapply(self, resource_group): + response = self.client.virtual_machines.begin_reapply( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1072,20 +1143,8 @@ def test_virtual_machines_begin_reimage(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_retrieve_boot_diagnostics_data(self, resource_group): - response = self.client.virtual_machines.retrieve_boot_diagnostics_data( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_virtual_machines_begin_perform_maintenance(self, resource_group): - response = self.client.virtual_machines.begin_perform_maintenance( + def test_virtual_machines_begin_restart(self, resource_group): + response = self.client.virtual_machines.begin_restart( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1096,8 +1155,8 @@ def test_virtual_machines_begin_perform_maintenance(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_simulate_eviction(self, resource_group): - response = self.client.virtual_machines.simulate_eviction( + def test_virtual_machines_retrieve_boot_diagnostics_data(self, resource_group): + response = self.client.virtual_machines.retrieve_boot_diagnostics_data( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1108,39 +1167,11 @@ def test_virtual_machines_simulate_eviction(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_begin_assess_patches(self, resource_group): - response = self.client.virtual_machines.begin_assess_patches( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2024-11-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_virtual_machines_begin_install_patches(self, resource_group): - response = self.client.virtual_machines.begin_install_patches( + def test_virtual_machines_begin_run_command(self, resource_group): + response = self.client.virtual_machines.begin_run_command( resource_group_name=resource_group.name, vm_name="str", - install_patches_input={ - "rebootSetting": "str", - "linuxParameters": { - "classificationsToInclude": ["str"], - "maintenanceRunId": "str", - "packageNameMasksToExclude": ["str"], - "packageNameMasksToInclude": ["str"], - }, - "maximumDuration": "str", - "windowsParameters": { - "classificationsToInclude": ["str"], - "excludeKbsRequiringReboot": bool, - "kbNumbersToExclude": ["str"], - "kbNumbersToInclude": ["str"], - "maxPatchPublishDate": "2020-02-20 00:00:00", - }, - }, + parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, api_version="2024-11-01", ).result() # call '.result()' to poll until service return final result @@ -1149,33 +1180,20 @@ def test_virtual_machines_begin_install_patches(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_begin_attach_detach_data_disks(self, resource_group): - response = self.client.virtual_machines.begin_attach_detach_data_disks( + def test_virtual_machines_simulate_eviction(self, resource_group): + response = self.client.virtual_machines.simulate_eviction( resource_group_name=resource_group.name, vm_name="str", - parameters={ - "dataDisksToAttach": [ - { - "diskId": "str", - "caching": "str", - "deleteOption": "str", - "diskEncryptionSet": {"id": "str"}, - "lun": 0, - "writeAcceleratorEnabled": bool, - } - ], - "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], - }, api_version="2024-11-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_virtual_machines_begin_migrate_to_vm_scale_set(self, resource_group): - response = self.client.virtual_machines.begin_migrate_to_vm_scale_set( + def test_virtual_machines_begin_start(self, resource_group): + response = self.client.virtual_machines.begin_start( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1186,13 +1204,12 @@ def test_virtual_machines_begin_migrate_to_vm_scale_set(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_virtual_machines_begin_run_command(self, resource_group): - response = self.client.virtual_machines.begin_run_command( + def test_virtual_machines_list_available_sizes(self, resource_group): + response = self.client.virtual_machines.list_available_sizes( resource_group_name=resource_group.name, vm_name="str", - parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, api_version="2024-11-01", - ).result() # call '.result()' to poll until service return final result - + ) + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations_async.py b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations_async.py index 702fca5ceab9..509635e9501e 100644 --- a/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations_async.py +++ b/sdk/compute/azure-mgmt-compute/generated_tests/test_compute_management_virtual_machines_operations_async.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.compute.aio import ComputeManagementClient +from azure.mgmt.compute.v2024_11_01.aio import ComputeManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -32,15 +33,33 @@ async def test_virtual_machines_list_by_location(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_begin_capture(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_capture( - resource_group_name=resource_group.name, - vm_name="str", - parameters={"destinationContainerName": "str", "overwriteVhds": bool, "vhdPrefix": "str"}, - api_version="2024-11-01", - ) - ).result() # call '.result()' to poll until service return final result + async def test_virtual_machines_list_all(self, resource_group): + response = self.client.virtual_machines.list_all( + api_version="2024-11-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_virtual_machines_list(self, resource_group): + response = self.client.virtual_machines.list( + resource_group_name=resource_group.name, + api_version="2024-11-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_virtual_machines_get(self, resource_group): + response = await self.client.virtual_machines.get( + resource_group_name=resource_group.name, + vm_name="str", + api_version="2024-11-01", + ) # please add some check logic here by yourself # ... @@ -356,6 +375,7 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): "proximityPlacementGroup": {"id": "str"}, "resources": [ { + "location": "str", "autoUpgradeMinorVersion": bool, "enableAutomaticUpgrade": bool, "forceUpdateTag": "str", @@ -383,7 +403,6 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): "type": "str", "typeHandlerVersion": "str", }, - "location": "str", "name": "str", "protectedSettings": {}, "protectedSettingsFromKeyVault": {"secretUrl": "str", "sourceVault": {"id": "str"}}, @@ -392,6 +411,14 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): "publisher": "str", "settings": {}, "suppressFailures": bool, + "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", "typeHandlerVersion": "str", @@ -486,6 +513,14 @@ async def test_virtual_machines_begin_create_or_update(self, resource_group): "writeAcceleratorEnabled": bool, }, }, + "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"}, "timeCreated": "2020-02-20 00:00:00", "type": "str", @@ -922,24 +957,56 @@ async def test_virtual_machines_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_get(self, resource_group): - response = await self.client.virtual_machines.get( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2024-11-01", - ) + async def test_virtual_machines_begin_assess_patches(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_assess_patches( + resource_group_name=resource_group.name, + vm_name="str", + api_version="2024-11-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_virtual_machines_instance_view(self, resource_group): - response = await self.client.virtual_machines.instance_view( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2024-11-01", - ) + async def test_virtual_machines_begin_attach_detach_data_disks(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_attach_detach_data_disks( + resource_group_name=resource_group.name, + vm_name="str", + parameters={ + "dataDisksToAttach": [ + { + "diskId": "str", + "caching": "str", + "deleteOption": "str", + "diskEncryptionSet": {"id": "str"}, + "lun": 0, + "writeAcceleratorEnabled": bool, + } + ], + "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], + }, + api_version="2024-11-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_virtual_machines_begin_capture(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_capture( + resource_group_name=resource_group.name, + vm_name="str", + parameters={"destinationContainerName": "str", "overwriteVhds": bool, "vhdPrefix": "str"}, + api_version="2024-11-01", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @@ -986,42 +1053,52 @@ async def test_virtual_machines_generalize(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_list(self, resource_group): - response = self.client.virtual_machines.list( - resource_group_name=resource_group.name, - api_version="2024-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + async def test_virtual_machines_begin_install_patches(self, resource_group): + response = await ( + await self.client.virtual_machines.begin_install_patches( + resource_group_name=resource_group.name, + vm_name="str", + install_patches_input={ + "rebootSetting": "str", + "linuxParameters": { + "classificationsToInclude": ["str"], + "maintenanceRunId": "str", + "packageNameMasksToExclude": ["str"], + "packageNameMasksToInclude": ["str"], + }, + "maximumDuration": "1 day, 0:00:00", + "windowsParameters": { + "classificationsToInclude": ["str"], + "excludeKbsRequiringReboot": bool, + "kbNumbersToExclude": ["str"], + "kbNumbersToInclude": ["str"], + "maxPatchPublishDate": "2020-02-20 00:00:00", + }, + }, + api_version="2024-11-01", + ) + ).result() # call '.result()' to poll until service return final result - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_list_all(self, resource_group): - response = self.client.virtual_machines.list_all( - api_version="2024-11-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_virtual_machines_list_available_sizes(self, resource_group): - response = self.client.virtual_machines.list_available_sizes( + async def test_virtual_machines_instance_view(self, resource_group): + response = await self.client.virtual_machines.instance_view( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-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_virtual_machines_begin_power_off(self, resource_group): + async def test_virtual_machines_begin_migrate_to_vm_scale_set(self, resource_group): response = await ( - await self.client.virtual_machines.begin_power_off( + await self.client.virtual_machines.begin_migrate_to_vm_scale_set( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1033,9 +1110,9 @@ async def test_virtual_machines_begin_power_off(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_begin_reapply(self, resource_group): + async def test_virtual_machines_begin_perform_maintenance(self, resource_group): response = await ( - await self.client.virtual_machines.begin_reapply( + await self.client.virtual_machines.begin_perform_maintenance( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1047,9 +1124,9 @@ async def test_virtual_machines_begin_reapply(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_begin_restart(self, resource_group): + async def test_virtual_machines_begin_power_off(self, resource_group): response = await ( - await self.client.virtual_machines.begin_restart( + await self.client.virtual_machines.begin_power_off( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1061,9 +1138,9 @@ async def test_virtual_machines_begin_restart(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_begin_start(self, resource_group): + async def test_virtual_machines_begin_reapply(self, resource_group): response = await ( - await self.client.virtual_machines.begin_start( + await self.client.virtual_machines.begin_reapply( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1103,21 +1180,9 @@ async def test_virtual_machines_begin_reimage(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_retrieve_boot_diagnostics_data(self, resource_group): - response = await self.client.virtual_machines.retrieve_boot_diagnostics_data( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2024-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_virtual_machines_begin_perform_maintenance(self, resource_group): + async def test_virtual_machines_begin_restart(self, resource_group): response = await ( - await self.client.virtual_machines.begin_perform_maintenance( + await self.client.virtual_machines.begin_restart( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1129,8 +1194,8 @@ async def test_virtual_machines_begin_perform_maintenance(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_simulate_eviction(self, resource_group): - response = await self.client.virtual_machines.simulate_eviction( + async def test_virtual_machines_retrieve_boot_diagnostics_data(self, resource_group): + response = await self.client.virtual_machines.retrieve_boot_diagnostics_data( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1141,42 +1206,12 @@ async def test_virtual_machines_simulate_eviction(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_begin_assess_patches(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_assess_patches( - resource_group_name=resource_group.name, - vm_name="str", - api_version="2024-11-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_virtual_machines_begin_install_patches(self, resource_group): + async def test_virtual_machines_begin_run_command(self, resource_group): response = await ( - await self.client.virtual_machines.begin_install_patches( + await self.client.virtual_machines.begin_run_command( resource_group_name=resource_group.name, vm_name="str", - install_patches_input={ - "rebootSetting": "str", - "linuxParameters": { - "classificationsToInclude": ["str"], - "maintenanceRunId": "str", - "packageNameMasksToExclude": ["str"], - "packageNameMasksToInclude": ["str"], - }, - "maximumDuration": "str", - "windowsParameters": { - "classificationsToInclude": ["str"], - "excludeKbsRequiringReboot": bool, - "kbNumbersToExclude": ["str"], - "kbNumbersToInclude": ["str"], - "maxPatchPublishDate": "2020-02-20 00:00:00", - }, - }, + parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, api_version="2024-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -1186,36 +1221,21 @@ async def test_virtual_machines_begin_install_patches(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_begin_attach_detach_data_disks(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_attach_detach_data_disks( - resource_group_name=resource_group.name, - vm_name="str", - parameters={ - "dataDisksToAttach": [ - { - "diskId": "str", - "caching": "str", - "deleteOption": "str", - "diskEncryptionSet": {"id": "str"}, - "lun": 0, - "writeAcceleratorEnabled": bool, - } - ], - "dataDisksToDetach": [{"diskId": "str", "detachOption": "str"}], - }, - api_version="2024-11-01", - ) - ).result() # call '.result()' to poll until service return final result + async def test_virtual_machines_simulate_eviction(self, resource_group): + response = await self.client.virtual_machines.simulate_eviction( + resource_group_name=resource_group.name, + vm_name="str", + api_version="2024-11-01", + ) # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_begin_migrate_to_vm_scale_set(self, resource_group): + async def test_virtual_machines_begin_start(self, resource_group): response = await ( - await self.client.virtual_machines.begin_migrate_to_vm_scale_set( + await self.client.virtual_machines.begin_start( resource_group_name=resource_group.name, vm_name="str", api_version="2024-11-01", @@ -1227,15 +1247,12 @@ async def test_virtual_machines_begin_migrate_to_vm_scale_set(self, resource_gro @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_virtual_machines_begin_run_command(self, resource_group): - response = await ( - await self.client.virtual_machines.begin_run_command( - resource_group_name=resource_group.name, - vm_name="str", - parameters={"commandId": "str", "parameters": [{"name": "str", "value": "str"}], "script": ["str"]}, - api_version="2024-11-01", - ) - ).result() # call '.result()' to poll until service return final result - + async def test_virtual_machines_list_available_sizes(self, resource_group): + response = self.client.virtual_machines.list_available_sizes( + resource_group_name=resource_group.name, + vm_name="str", + api_version="2024-11-01", + ) + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/compute/azure-mgmt-compute/setup.py b/sdk/compute/azure-mgmt-compute/setup.py index 6d91083b1fb1..79c147630d31 100644 --- a/sdk/compute/azure-mgmt-compute/setup.py +++ b/sdk/compute/azure-mgmt-compute/setup.py @@ -53,7 +53,6 @@ "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", @@ -77,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", )